kwbase CLI Deployment
Prerequisites
- KWDB source code is compiled and installed according to KWDB Compilation and Installation Instructions..
- The hardware configuration, operating system, software dependencies, and ports of the node to be deployed meet the installation deployment requirements.
- Installation user is
rootor a regular user withsudoprivileges.
Note
The kwbase CLI deployment method described in this section only applies to bare-metal deployment.
Steps
Navigate to the directory where the
kwbasescript is located:cd /home/go/src/gitee.com/kwbasedb/install/bin(Optional) For secure mode, create certificates and keys by following these steps:
Create a directory to store the certificates and keys:
mkdir -p <certs_dir>Generate certificates and keys:
# Create database certificate authority and key ./kwbase cert create-ca --certs-dir=<certs_dir> --ca-key=<certs_dir>/ca.key && \ # Create client certificate and key for database installation user (replace username with actual username) ./kwbase cert create-client <username> --certs-dir=<certs_dir> --ca-key=<certs_dir>/ca.key && \ # Create node certificate and key ./kwbase cert create-node 127.0.0.1 localhost 0.0.0.0 --certs-dir=<certs_dir> --ca-key=<certs_dir>/ca.key
Start the database.
Insecure mode:
./kwbase start-single-node --insecure \ --listen-addr=0.0.0.0:26257 \ --http-addr=0.0.0.0:8080 \ --store=/var/lib/kaiwudbSecure mode:
./kwbase start-single-node \ --certs-dir=<certs_dir> \ --listen-addr=0.0.0.0:26257 \ --http-addr=0.0.0.0:8080 \ --store=/var/lib/kaiwudb
Check database status.
Insecure mode:
./kwbase node status --insecure --host=<address_of_any_alive_node>Secure mode:
./kwbase node status --certs-dir=<certs_dir> --host=<address_of_any_alive_node>
(Optional) Create a database user and grant administrator privileges to the user. If this step is skipped, the system will use database deployment user by default, and no password is required to access the database.
Insecure mode (without password):
./kwbase sql --host=127.0.0.1:<local_port> --insecure \ -e "create user <username>; \ grant admin to <username> with admin option;"Secure mode (with password):
./kwbase sql --certs-dir=<certs_dir> --host=127.0.0.1:<local_port> \ -e "create user <username> with password \"<user_password>\"; \ grant admin to <username> with admin option;"
After deployment, connect to and manage KWDB using kwbase CLI, KaiwuDB JDBC, or KaiwuDB Developer Center.