DataStax Devcenter fails to connect to the remote cassandra database

前端 未结 4 946
遇见更好的自我
遇见更好的自我 2021-01-18 08:40

OS: CentOS 6.4 (server)

I have successfully installed (yum install dsc20) the cassandra database layer in my server and can connect to it using the CQL SHel (cqlsh).

相关标签:
4条回答
  • 2021-01-18 08:55

    If there's somebody working with docker locally, it can run this command.

    docker run --name cassandra -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160 
    -e CASSANDRA_LISTEN_ADDRESS=localhost 
    -e CASSANDRA_BROADCAST_ADDRESS=localhost
    -e CASSANDRA_RPC_ADDRESS=localhost -d cassandra
    
    0 讨论(0)
  • 2021-01-18 08:56

    DataStax DevCenter being built on top of the DataStax Java driver has the same connectivity requirements as the driver. Namely:

    1. start_native_transport: true
    2. rpc_address: IP or hostname reachable from the client
    3. Machines in the cluster accept connections on port 9042 (the native_transport_port config option)

    If rpc_address is set to either a private IP or to 0.0.0.0, DevCenter will not know what node to connect to.

    If your cluster has multiple nodes and these are using rpc_address: 0.0.0.0, even if you configure DevCenter with the IP(s) of a couple of nodes, it will still have issues discovering the other nodes in the cluster.

    In cassandra.yaml there's a comment/warning about using rpc_address: 0.0.0.0:

    Note that unlike ListenAddress above, it is allowed to specify 0.0.0.0 here if you want to listen on all interfaces, but that will break clients that rely on node auto-discovery.

    Note: it is possible that in the future DevCenter might be able to ignore/filter out nodes in the cluster configured with rpc_address: 0.0.0.0.

    0 讨论(0)
  • 2021-01-18 09:05

    Try this.. It worked for me!

    Run the following command on your machine where you have DevCenter installed

    $> ssh -L 9042:localhost:9042 <username>@<ip-address-cassandra-db> -N
    

    After running this command, it will prompt for password

    Now in your DevCenter > Contact Hosts, provide "127.0.0.1" and test connection. Bingo, you see the magic...

    0 讨论(0)
  • 2021-01-18 09:05

    In the cassandra.yaml, I set

    1. listen_address: localhost
    2. rpc_address: 1.2.3.4
    3. broadcast_rpc_address: 1.2.3.4

    After doing a

    sudo service cassandra restart

    DevCenter was able to successfully connect.

    After this change, cqlsh would not start without the address:

    cqlsh 1.2.3.4

    You can set the environment variable $CQLSH_HOST=1.2.3.4. Then simply type cqlsh.

    0 讨论(0)
提交回复
热议问题