I'm trying to get my SphinxQL-installation to work on my Ubuntu 16.04LTS environment. However, I can't connect to the server. The configuration I use is below:
searchd
{
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinxsearch/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
binlog_path = /var/lib/sphinxsearch/data
}
In order to confirm or the daemon is running, I executed: sudo systemctl status sphinxsearch.service
which returns:
sphinxsearch.service - LSB: Fast standalone full-text SQL search engine
Loaded: loaded (/etc/init.d/sphinxsearch; bad; vendor preset: enabled)
Active: active (running) since Thu 2018-06-07 11:23:09 CEST; 12min ago
Docs: man:systemd-sysv-generator(8)
Process: 10552 ExecStop=/etc/init.d/sphinxsearch stop (code=exited, status=0/SUCCESS)
Process: 10614 ExecStart=/etc/init.d/sphinxsearch start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/sphinxsearch.service
├─10621 /usr/bin/searchd
└─10622 /usr/bin/searchd
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: listening on all interfaces, port=9306
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: Sphinx 2.2.9-id64-release (rel22-r5006)
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: Copyright (c) 2001-2015, Andrew Aksyonoff
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: precaching index 'I2455'
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: [1.4K blob data]
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: Copyright (c) 2001-2015, Andrew Aksyonoff
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)
Jun 07 11:23:09 Serv001 sphinxsearch[10614]: sphinxsearch.
Jun 07 11:23:09 Serv001 systemd[1]: Started LSB: Fast standalone full-text SQL search engine.
To verify that the daemon is listening, I executed: sudo lsof -i -P -n | grep LISTEN
which shows me:
searchd 10622 sphinxsearch 8u IPv4 423245474 0t0 TCP *:9306 (LISTEN)
However, when I try to connect with: mysql -h0 -P9306
it returns me: ERROR 2002 (HY000): Can't connect to MySQL server on '0' (115)
after a while
Note: The indexes have built without a problem, so a DB-connection has been established earlier
Note2: I followed this documentation
So, what am I doing wrong that I can't connect to SphinxQL at port 9306?
From your iptables it looks like you blacklist everything (see the DROP line in the INPUT chain) and then whitelist only selected ports. So to allow access to 9306 you should do
iptables -A INPUT -p tcp --destination-port 9306 -j ACCEPT