I'm run Cassandra docker container:
docker pull cassandra
run --name cassandra -p 9042:9042 -p 9160:9160 -d cassandra
The netstat -tpln is:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
LISTEN - tcp6 0 0 [::]:9160 [::]:*
LISTEN - tcp6 0 0 [::]:9042 [::]:*
Connection to C* from local cqlsh is Ok:
docker exec -it cassandra /bin/bash
#cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.1.1 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh> show host
Connected to Test Cluster at 127.0.0.1:9042.
I install the local cqlsh:
$cqlsh --version
cqlsh 4.1.1
but, I don't connecton with docker container from localhost:
$sqlsh
Traceback (most recent call last):
File "/usr/sbin/cqlsh", line 2067, in <module>
main(*read_options(sys.argv[1:], os.environ))
. . .
File "/home/akalend/src/cqlsh_standalone/lib/thrift-python-internal-only-0.9.1.zip/thrift/transport/TSocket.py", line 103, in read
socket.error: [Errno 104] Connection reset by peer
So, I don't connection from localhost php-driver.
How I can connection cassandra docker with my php script & cqlsh?
Why docker mapping port to tcp6, do not tcp4 ? resolve
Why the local cqlsh (version 4.1) connect by 9160 port, but docker container cqlsh(version 5.0.1) connect by 9042 port?
added info
If run conteiner as:
run --name cassandra -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 -d cassandra
I have listen ip4 ports:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9160 0.0.0.0:* LISTEN 2454/docker-proxy
tcp 0 0 127.0.0.1:9042 0.0.0.0:* LISTEN 2462/docker-proxy
but I havn't connection with cqlsh & php
socket.error: [Errno 104] Connection reset by peer
PHP Fatal error: Uncaught exception 'Cassandra\Exception\RuntimeException' with message 'No hosts available for the control connection' in /home/akalend/projects/test/cassa/test.php:7
Stack trace:
#0 /home/akalend/projects/test/cassa/test.php(7): Cassandra\DefaultCluster->connect('system')
#1 {main} thrown in /home/akalend/projects/test/cassa/test.php on line 7