Connecting to an Instance Using an EIP
You can connect to a GeminiDB Redis instance from an ECS or a local device over a public network.
This section uses the Linux OS as an example to describe how to connect to a GeminiDB Redis instance using the Redis-cli client. You can connect to a GeminiDB Redis instance to avoid SPOFs and achieve load balancing in the production environment.
You can connect to an instance over SSL or non-SSL connections. SSL encrypts data and is more secure. For details, see Connecting to a instance Using SSL. This section describes how to connect to a GeminiDB Redis instance over a non-SSL connection.
Precautions
- To connect to a DB instance over a non-SSL connection, SSL must be disabled. For details about how to disable SSL, see Configuring an SSL Connection.
- You need to estimate the bandwidth required by services and purchase an EIP with sufficient bandwidth resources. Client access exceptions caused by poor public network performance will not be included in the SLA.
Prerequisites
- 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.
- You have bound an EIP to a node of the purchased instance and configure security group rules for the node. For details, see Binding and Unbinding an EIP and Configuring Security Group Rules for Nodes.
A GeminiDB Redis instance can have multiple nodes. Select any node and bind an EIP to it.
Procedure
- Log in to the ECS. For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
- Obtain the Redis client.
Method 1
Run the following command to download the Redis client.
wget http://download.redis.io/releases/redis-6.2.0.tar.gz
Method 2
Download the Redis client and upload it to the ECS.
- Decompress the client package.
tar -xzf redis-6.2.0.tar.gz
- Connect to the DB instance in the src directory.
cd redis-6.2.0 make cd src ./redis-cli -h <DB_HOST> -p <DB_PORT> -a <DB_PWD>
Example:
./redis-cli -h 192.168.0.208 -p 8635 -a <DB_PWD>
Table 1 Parameter description Parameter
Description
<DB_HOST>
EIP bound to the instance to be connected.
To obtain the EIP, go to the Instance Management page and click the target instance name. The EIP can be found in the EIP column in the Node Information area on the Basic Information page.
If the instance you bought has multiple nodes, you can bind the EIP to any node to connect to the instance.
If a message is displayed indicating that no EIP has been bound to the instance, bind an EIP to the instance by following Binding and Unbinding an EIP.
<DB_PORT>
Port for accessing the target instance. Configure this parameter based on service requirements.
To obtain the instance port number, perform the following steps:
Click the target instance to go to the Basic Information page. In the Network Information area, you can find the database port.
<DB_PWD>
Administrator password set when you buy a GeminiDB Redis instance
- Check the results. If the following information is displayed, the connection is successful.
IP:port>
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.