I am launching the Cassandra docker container:
docker pull cassandra
run --name cassandra -p 9042:9042 -p 9160:9160 -d cassandra
Netstat -tpln:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
LISTEN - tcp6 0 0 [::]:9160 [::]:*
LISTEN - tcp6 0 0 [::]:9042 [::]:*
The connection to C * from local cqlsh is Ok:
docker exec -it cassandra /bin/bash
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 local cqlsh:
$cqlsh --version
cqlsh 4.1.1
but I am not connecting to the 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 am not connecting from the php driver localhost.
How can I connect cassandra docker with my php script and cqlsh?
Why is docker mapping port for tcp6, not tcp4? Determination
Why is the local cqlsh (version 4.1) connected via port 9160, but the docker cqlsh container (version 5.0.1) connected to port 9042?
information added
If you run conteiner like:
run --name cassandra -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 -d cassandra
I have ip4 ports for ip4:
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 don't mess with cqlsh and 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: