Connecting to an Instance over a Private Network
You can install the Cassandra client on the ECS and access the instance through a private IP address.
GeminiDB Cassandra API allows you to connect to an instance over SSL or non-SSL connections. SSL encrypts data and is more secure.
Precautions
- The target instance must be in the same VPC and subnet as the ECS.
- The ECS must be in a security group that has access to the instances. For details, see Configuring Security Group Rules.
Prerequisites
- A GeminiDB Cassandra instance has been created and is running properly.
- An ECS has been created. The following uses a Linux ECS as an example.
For details, see Purchasing an ECS in Getting Started with Elastic Cloud Server.
- Download and install the Cassandra client that matches the CPU type of the ECS.
- If the CPU type is x86, download the Cassandra client.
- If the CPU type is Kunpeng, download the Cassandra client.
- Before connecting to an instance over SSL, obtain an SSL certificate. For details, see Downloading the SSL Certificate.
Non-SSL Connection
- Log in to ECS.
For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
- Upload the Cassandra client installation package to the ECS.
- Run the following command to decompress the client installation package. The x86 client is used as an example.
unzip Cassandra_cqlsh_x86_64.zip
- Run the following command to grant the execute permission on all files:
chmod +x *
- Connect to the DB instance in the directory where the cqlsh tool is located.
./cqlsh <DB_HOST> <DB_PORT> -u <DB_USER>
Example:
./cqlsh 192.xx.xx.xx 8635 -u rwuser
Table 1 Description Parameter
Description
<DB_HOST>
The private IP address of the instance to be connected.
To obtain this IP address, go to the Instance Management page and click the target instance name. The IP address can be found in the Private IP Address field under Node Information on the Basic Information page.
If the instance you purchased has multiple nodes, select the private IP address of any node.
Figure 1 Viewing the private IP address
<DB_PORT>
Port number of the instance to be connected. The default port number is 8635. Replace it with the actual port number.
Click the instance name to go to the Basic Information page and obtain the port number in the Network Information area.
Figure 2 Viewing the port number
<DB_USER>
Username of the instance administrator. The default value is rwuser.
- Check the results. If the following information is displayed, the connection is successful.
rwuser@cqlsh>
SSL
- Log in to ECS.
For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
- Upload the Cassandra client installation package to the ECS.
- Upload the SSL certificate to the ECS.
- Run the following command to decompress the client installation package. The x86 client is used as an example.
unzip Cassandra_cqlsh_x86_64.zip
- Run the following command to grant the execute permission on all files:
chmod +x *
- Connect to the DB instance in the directory where the cqlsh tool is located.
export SSL_CERTFILE=/<PATH_OF_SSL_CERT_FILE>
export SSL_VERSION=TLSv1_2
./cqlsh <DB_HOST> <DB_PORT> --ssl -u <DB_USER>
Example:
./cqlsh 192.168.1.8 8635 --ssl -u rwuser
Table 2 Description Parameter
Description
<PATH_OF_SSL_CERT_FILE>
SSL file path.
<DB_HOST>
The private IP address of the instance to be connected.
To obtain this IP address, go to the Instance Management page and click the target instance name. The IP address can be found in the Private IP Address field under Node Information on the Basic Information page.
If the instance you purchased has multiple nodes, select the private IP address of any node.
Figure 3 Viewing the private IP address
<DB_PORT>
Port number of the instance to be connected. The default port number is 8635. Replace it with the actual port number.
Click the instance name to go to the Basic Information page and obtain the port number in the Network Information area.
Figure 4 Viewing the port number
<DB_USER>
Username of the instance administrator. The default value is rwuser.
- Check the results. If the following information is displayed, the connection is successful.
rwuser@cqlsh>
Follow-up Operations
After logging in to the instance, you can create keyspaces, databases, or tables. For details, see Buying and Connecting to a GeminiDB Cassandra Instance.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot