连接到远程服务器上的 sphinx

连接到远程服务器上的 sphinx

我最近将 sphinx 移到了与我们的数据库相同的服务器上,因此我们的架构是:

  1. 托管我们的 Web 应用程序的文件服务器
  2. 带有 Sphinx 实例的数据库服务器 (searchd)

当我尝试连接到 sphinx 时ip.to.db.server出现以下错误:

Sphinx response connection to ip.to.db.server:9312 failed (errno=113, msg=No route to host)

我需要做些什么特殊的事情才能使我的 Web 应用程序可以访问端口 9312?

当前TCP端口LISTEN

tcp        0      0 0.0.0.0:9306                0.0.0.0:*                   LISTEN      23496/searchd       
tcp        0      0 0.0.0.0:9312                0.0.0.0:*                   LISTEN      23496/searchd 

输出iptables -L

Chain INPUT (policy ACCEPT) 
target     prot opt source               destination         
fail2ban-ssh  tcp  --  anywhere             anywhere            multiport dports ssh 
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh /* SSH */ 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:lmsocialserver /* monit */ 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https /* HTTPS */ 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:webcache /* HTTPProxy */ 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http /* HTTP */ 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql /* MySQL */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  ipremoved_by_poster  anywhere            /* Rackspace monitoring */ 
ACCEPT     all  --  anywhere             anywhere            /* localhost */ 
ACCEPT     icmp --  anywhere             anywhere            icmp any /* ping */ 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere 

我已经搜索了很多次,但目前还没有结果。任何帮助我都非常感谢。

答案1

问题是IPTABLES阻止了我的远程连接,因此我添加了两行以确保安全:

vi /etc/sysconfig/iptables

添加以下行:

-A RH-Firewall-1-INPUT -i eth1 -p tcp -m tcp --dport 9312 -m comment --comment "Sphinx" -j ACCEPT
-A RH-Firewall-1-INPUT -s your.remote.ip.address/32 -i eth0 -p tcp -m tcp --dport 9312 -j ACCEPT

将端口调整9312为 Sphinx 正在监听的端口。

然后我跑了service iptables restart,狮身人面像就走了!

感谢@mdpc 和@sciurus 为我指明正确的方向。

NOTE:Rackspace 使用RH-Firewall-1-INPUT,但您可能需要使用INPUT,或其他不同的东西

相关内容