Connect Warehouse
VeloDB Cloud uses the MySQL network connection protocol, so in terms of connection, it is compatible with MySQL command line tools, JDBC/ODBC and visualization tools, etc. The following uses MySQL Client, MySQL JDBC Connector and Navicat as examples.
MySQL Client
Download the MySQL Client from the official MySQL website, or download the installation-free MySQL Client (opens in a new tab) provided by us. Currently VeloDB Cloud is mainly compatible with MySQL 5.7 and above clients.
Get connection-related information from the "Connection" under the warehouse that needs to be connected in the management console of VeloDB Cloud.
Note:
The warehouse supports public network connection and private network (PrivateLink) connection. Different connection methods require different connection information.
The public network connection is open by default, and the IP whitelist is also open to the public by default. If you no longer need to connect to the warehouse from the public network, please close it.
For the first connection, please use the user admin and its password. You can initialize or reset it in the Setting page on VeloDB Cloud console.
Supposing that you are connecting to a warehouse using the following public link:
Download MySQL Client and unzip the file, find the mysql
command line tool under the bin/
directory. Execute the folowing command to connect to VeloDB.
mysql -h 34.199.74.195 -P 33641 -u admin
After login, if you see the following snippet, that usually means that your Client IP address has not been added to the connection whitelist on the console.
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
If the following is displayed, that means the connection succeeds.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 119952
Server version: 5.7.37 VeloDB Core version: 3.0.4
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
MySQL JDBC Connector
Please download the JDBC Connector from the MySQL official website.
Configure the connection according to the JDBC connection information in the connection information on the console.
In the original Apache Doris, it is often necessary to configure multiple FE node addresses in order to provide highly available FE services. In VeloDB Cloud, there is no need to configure multiple FE node addresses, only a single IP given by the console is required. This IP is the IP of the load balancer, and there are multiple servers providing services at the backend, so load balancing and high availability can be guaranteed.
The following is to use JDBC to connect to VeloDB Cloud warehouse and display all cluster information under the current warehouse.
In JDBC, where the database name was originally passed, we can pass three things.
- database_name, such as jdbc:mysql://34.199.74.195:33641/test, then the database test will be used, and the user's default computing cluster will be used.
- database_name@cluster_name, such as jdbc:mysql://34.199.74.195:33641/test@cluster1, then the database test will be used and the computing cluster cluster1 will be used.
String user = "admin";
String password = "admin_password";
String newUrl = "jdbc:mysql://34.199.74.195:33641/test@cluster1?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true";
try {
Connection myCon = DriverManager.getConnection(newUrl, user, password);
Statement stmt = myCon.createStatement();
ResultSet result = stmt.executeQuery("show clusters");
ResultSetMetaData metaData = result.getMetaData();
int columnCount = metaData.getColumnCount();
while (result.next()) {
for (int i = 1; i <= columnCount; i++) {
System.out.println(result.getObject(i));
}
}
} catch (SQLException e) {
log.error("get JDBC connection exception.", e);
}
Navicat
Create a MySQL connection to the VeloDB Cloud warehouse.
Confirm the connection is successful.
Other connection methods
Although VeloDB Cloud is highly compatible with the MySQL protocol and usage methods, these client tools or GUI tools natively designed for MySQL are mainly for managing MySQL databases. When interacting with VeloDB Cloud, the experience will be not very good. Therefore, VeloDB has provided a user-friendly visual WebUI tools (VeloDB WebUI) and is developing native command-line tools (VeloDB CLI), so tay tuned.