Buying and Connecting to a GeminiDB Influx Instance
This section describes how to buy a GeminiDB Influx instance and uses a Linux ECS as an example to describe how to connect to the instance over a private network.
- Step 1: Buy a GeminiDB Influx Instance
- Step 2: Buy an Instance
- Step 3: Connect to the GeminiDB Influx Instance
- Basic Syntax
Step 1: Buy a GeminiDB Influx Instance
- Log in to the GeminiDB console.
- In the service list, choose Databases > GeminiDB Influx API.
- On the Instances page, click Buy DB Instance.
- Click Buy DB Instance, select a billing mode, and configure instance parameters. Then, click Next and complete subsequent operations.
Figure 1 Basic information
Figure 2 Selecting specifications
Figure 3 Network settings
Figure 4 Setting a password
- View the purchased GeminiDB Influx instance.
Figure 5 Successful purchase
Step 2: Buy an Instance
- Log in to the GeminiDB console.
- In the service list, choose > . On the Elastic Cloud Server console, click Buy ECS.
- Configure basic settings and click Next: Configure Network. Make sure that the ECS is in the same region, AZ, VPC, and security group as the GeminiDB Influx instance you created.
Figure 6 Basic settings
Figure 7 Selecting specifications
Figure 8 Selecting an image
- Configure the ECS network and click Next: Configure Advanced Settings. Make sure that the ECS is in the same VPC and security group as the GeminiDB Influx instance.
- If security group rules allow access from the ECS, you can connect to the instance using the ECS.
- If the security group rules do not allow access from the ECS, add an inbound rule to the security group.
Figure 9 Network settings
Figure 10 Selecting an EIP
- Configure a password for the ECS and click Next: Confirm.
Figure 11 Advanced settings
- Confirm the configurations and click Submit.
Figure 12 Confirming the configurations
- View the purchased ECS.
Step 3: Connect to the GeminiDB Influx Instance
- On the ECS console, log in to the ECS using the remote login option.
Figure 13 Remote login
- Enter the username and password of the ECS.
Figure 14 Entering the username and password
- Download the InfluxDB client.
Method 1:
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.9-static_linux_amd64.tar.gz
Method 2:
Download the InfluxDB client package using your browser and upload the package to the ECS.
- Decompress the client package.
tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz
- Connect to your instance in the directory where the InfluxDB client is located.
- Run the following command to go to the InfluxDB directory:
- Connect to the GeminiDB Influx instance.
./influx -ssl -unsafeSsl -username '<DB_USER>' -password '<DB_PWD>' -host <DB_HOST> -port <DB_PORT>
Example:
./influx -ssl -unsafeSsl -username 'rwuser' -password '<DB_PWD>' -host 192.xx.xx.xx -port 8635
Table 1 Required description Parameter
Description
<DB_USER>
Username of the administrator account. The default value is rwuser.
On the Instances page, locate the instance and click its name. In the DB Information area on the Basic Information page, you can find the administrator username.
<DB_PWD>
Administrator password
<DB_HOST>
Load balancer address of the instance to be connected.
The load balancer address is in the open beta test (OBT) phase. To use it, contact customer service.
Scenario 1:
If you have obtained a load balancer address before creating an instance, you can view that the load balancer address is selected by default on the instance creation page.
After the instance is created, click its name to go to the Basic Information page and obtain the load balancer IP address in the Network Information area.
Scenario 2:
If you have already created an instance, you can contact customer service to assign a load balancer IP address to the instance.
Then you can click the instance name to view the load balancer IP address in the Network Information area on the Basic Information page.
<DB_PORT>
Port for accessing the instance.
Click the name of the instance to go to the Basic Information page. In the Network Information area, you can find the database port.
- If information similar to the following is displayed, the connection was successful.
Connected to https://host:port version 1.7.4 InfluxDB shell version: 1.7.9 >
Basic Syntax
- Database syntax
- Create a database.
create_database_stmt = "CREATE DATABASE" db_name
[ WITH
[ retention_policy_duration ]
[ retention_policy_replication ]
[ retention_policy_shard_group_duration ]
[ retention_policy_name ]
] .
The commands in square brackets ([]) are optional.
Example:
- Creating database mydb
CREATE DATABASE "mydb"
- Creating database mydb, configuring retention policy myrp to retain data for 1 day, keeping 1 a copy, and setting the storage duration for shardGroup to 30 minutes
CREATE DATABASE "mydb" WITH DURATION 1d REPLICATION 1 SHARD DURATION 30m NAME "myrp"
- Creating database mydb and using the default retention policy, myrp
CREATE DATABASE "mydb" WITH NAME "myrp"
- Creating database mydb
- Query databases.
- Switch to another database.
- Delete a database.
- Create a database.
- RETENTION POLICY
- Create a retention policy and ensure that the policy name does not contain periods (,), colons (:), semicolons (;), or dots (.).
create_retention_policy_stmt = "CREATE RETENTION POLICY" policy_name on_clause
retention_policy_duration
retention_policy_replication
[ retention_policy_shard_group_duration ]
[ "DEFAULT" ] .
The commands in square brackets ([]) are optional.
Example:
- Creating a data retention policy
CREATE RETENTION POLICY "10m_events" ON "somedb" DURATION 60m REPLICATION 2
- Creating a data retention policy and setting it as the default retention policy
CREATE RETENTION POLICY "10m_events" ON "somedb" DURATION 60m REPLICATION 2 DEFAULT
- Creating a data retention policy and specifying the storage duration for shardGroup
CREATE RETENTION POLICY "10m_events" ON "somedb" DURATION 60m REPLICATION 2 SHARD DURATION 30m
- Creating a data retention policy
- View a retention policy.
show retention policies on <database name>
If you specify both parameters retention_policy_duration and retention_policy_shard_group_duration, ensure that the former parameter has a greater value than the latter.
- Delete a retention policy.
- Modify a retention policy.
Alter_retention_policy_stmt = "ALTER RETENTION POLICY" policy_name on_clause
retention_policy_option
[ retention_policy_option ]
[ retention_policy_option ]
[ retention_policy_option ] .
The commands in square brackets ([]) are optional.
Example:
- Create a retention policy and ensure that the policy name does not contain periods (,), colons (:), semicolons (;), or dots (.).
- Adding data
insert into <retention policy> measurement,tagKey=tagValue fieldKey=fieldValue timestamp
When a data record is inserted, the system will automatically create measurements as required.
- Use the default retention policy.
insert demo,name=LiSi math=99,english=90,language=95
Add a data record, where measurement is demo, tag is name, and there are three fields math, english, and language.
- Use a specific retention policy.
insert into rp_1_hours demo,name=ZhangSan math=99,english=90,language=95
- Use the default retention policy.
- Querying data
- Modifying data
When you modify data using INSERT, if all tags and timestamps are the same, the existing data will be overwritten.
- Deleting data
You can create a retention policy to make data automatically deleted.
- HELP command
- Run the HELP command to view all supported commands.
Figure 15 Viewing all supported commands
- HELP <COMMAND> is used to query the usage of a command.
Example: HELP DESC
- Run the HELP command to view all supported commands.
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