Settings for Remote Connection to Cassandra
https://rdtschools.com/create-user-password-apache-cassandra/ “Creating New User with Password”
After that, some configuration updates are required. For that, you can see the link https://stackoverflow.com/questions/32051162/cassandra-cql-rolemanager-disable:
“I modified cassandra.yaml
file as below:
authenticator: org.apache.cassandra.auth.PasswordAuthenticator
authorizer: org.apache.cassandra.auth.CassandraAuthorizer
And restarted the node.”
> sudo nano /etc/cassandra/cassandra.yaml
After editing is done:
> sudo systemctl restart cassandra
> nodetool status
> cqlsh -u cassandra -p cassandra
Setting up Cassandra for remote access: https://gist.github.com/andykuszyk/7644f334586e8ce29eaf8b93ec6418c4 config updates must be performed in the file “cassandra.yaml”.
For the values stated as [node-ip], be careful: “the IP address of the host that Cassandra is running on (not a whitelist for the client IPs).”
Connection to Cassandra via a GUI (MAC)
https://dbschema.com/jdbc-drivers/CassandraJdbcDriver.zip should be downloaded and extracted (the output file will be cassandra-jdbc-driver-0.6.2-shaded.jar).
Install “DBeaver Community Edition”.
Perform all the steps in https://sagevoice.com/cassandra-on-macos/ starting from the 3rd step:
- When first launching DBeaver, cancel setting up a connection, and say ‘No’ to creating a sample database
- From the ‘Database’ menu choose ‘Driver Manager’
- In the modal dialog click the ‘New’ button
- In the ‘Driver Name’ field, enter ‘Cassandra’
- In the ‘Class Name’ field, enter ‘com.github.cassandra.jdbc.CassandraDriver’
- In the ‘URL Template’ field, enter ‘jdbc:c*:datastax://{host}[:{port}]/{database}’
- Click the ‘Add File’ button, and choose the ‘cassandra-jdbc-driver-0.6.4-shaded.jar’ downloaded previously
- Click ‘OK’ to save the Cassandra driver, and then ‘Close’ to close the ‘Driver Manager’
- From the ‘Database’ menu, pick ‘New Connection’
- Select ‘Cassandra’ from the list of database drivers and click ‘Next’
- Enter ‘localhost’ for the Host, ‘9042’ for the Port, ‘system’ for the Database/Schema, ‘cassandra’ for the User name, and ‘cassandra’ for the Password, then click ‘Next’
- Click ‘Next’ again to skip the Network config step, and then ‘Finish’ to save the connection.
I had installed Cassandra on my Ubuntu 18.04 Vagrant.
config.vm.network “private_network”, ip: “192.168.10.90”
config.vm.network “forwarded_port”, guest: 9042, host: 9042 → Do not forget to add Cassandra’s default port.
When you fill in Database/Schema, JDBC URL will be updated on its own:
Query your table after your insert:
Happy Coding!