This topic describes how to quickly deploy and experience OceanBase Database.
Prerequisites
Your server is connected to the Internet, and your hardware and software meet the following requirements.
| Item | Description |
|---|---|
| OS | · Anolis OS 8.X (Linux kernel V3.10.0 or later) · Red Hat Enterprise Linux Server 7.X (Linux kernel V3.10.0 or later) · CentOS Linux 7.X (Linux kernel V3.10.0 or later) |
| CPU | At least 2 cores or preferably 8 cores or more |
| Memory | At least 8 GB or preferably 32 GB or more Note At least 10 GB of memory is required if you use Docker to deploy OceanBase Database. |
| Disk type | SSD (recommended) |
| Disk space | Four times the memory size or more |
| File system | EXT4 or XFS. Choose XFS when the data volume exceeds 16 TB. |
Note
The following describes the deployment of OceanBase Database on an x86-based CentOS Linux 7.9 system. The procedure may be different on other OSs.
Use OBD to deploy OceanBase Database
Step 1: Download and install OBD
OceanBase Deployer (OBD) is the most efficient deployment tool to make OceanBase Database ready to work. We recommend that you use OBD when you deploy OceanBase Database for experience. Download and install OBD by performing the following steps.
If the server has access to the Internet and allows you to add a third-party YUM repository as the software source, you can run the following command to install OBD from the official software source of OceanBase:
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install -y ob-deploy
Step 2: Modify the configuration file
This section describes how to use OBD to deploy OceanBase Database. Perform the following steps:
1. Download the sample configuration file for OceanBase Database.
2. Add the home_path field to the configuration file:
oceanbase-ce:
global:
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path:
The home_path field specifies the working directory for OceanBase Database. OceanBase Database is started under this directory. You must create this directory in advance.
Step 3: Deploy and start an OceanBase cluster
Perform the following steps to deploy and start an OceanBase cluster:
Run the following command the deploy the cluster:
obd cluster autodeploy obtest -c quick_start_demo.yaml -AIn this example, obtest is the cluster name. You can specify a different cluster name. However, you can specify only one unique name for a cluster. If you specify the -A parameter, a test tenant is automatically created by using remaining resources of the system.
Run the following command to check the cluster status:
obd cluster display obtest
Step 4: Connect to OceanBase Database
Perform the following steps to connect to OceanBase Database:
Install the OceanBase Database client (OBClient):
If you have added the official YUM repository of OceanBase as the software source, run the following command to install the OBClient:
sudo yum install -y obclientRun the following command to connect to OceanBase Database by using the OBClient:
obclient -h127.0.0.1 -P2881 -uroot@testBy default, the OBClient connects to the OBServer by using port 2881. If you have changed the port, specify the port number that you use. tenant_name specifies the name of the tenant to connect to.
Run the following command to check the tenant information:MySQL [(none)]> use oceanbase; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MySQL [oceanbase]> select * from gv$tenant;
Use Docker to deploy OceanBase Database
Note
Before you deploy the oceanbase-ce image, make sure that the following prerequisites are met:
- The resources on your server are sufficient to support a Docker container with at least 2 CPU cores and 8 GB of memory.
- You have installed the latest version of Docker on your server. For more information, see the Docker Documentation.
- You have started the Docker service on your server.
Step 1: Start an OceanBase Database instance
Run the following command to start an OceanBase Database instance:
# Deploy an instance with the maximum specifications supported by the container.
docker run -p 2881:2881 --name obstandalone -d oceanbase/oceanbase-ce
## Deploy a mini standalone instance.
docker run -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d oceanbase/oceanbase-ce
Note
By default, the preceding command pulls the latest version of Docker image. You can select a desired docker image from Docker images as needed.
The process is expected to take two to five minutes. Run the following command. If boot success! is returned, the instance is started.
$ docker logs obstandalone | tail -1
boot success!
Step 2: Connect to the OceanBase Database instance
The oceanbase-ce image is integrated with the OBClient and the default connection script ob-mysql.
docker exec -it obstandalone ob-mysql sys # Connect to the root user of the SYS tenant.
docker exec -it obstandalone ob-mysql root # Connect to the root user of the test tenant.
docker exec -it obstandalone ob-mysql test # Connect to the test user of the test tenant.
You can also run the following command to connect to the instance by using the OBClient or MySQL client on your local server.
mysql -uroot -h127.1 -P2881
After the connection is established, the following information is displayed:
$ docker exec -it obstandalone ob-mysql sys
login as root@sys
Command is: obclient -h127.1 -uroot@sys -A -Doceanbase -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221487633
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Jul 15 2022 11:16:22)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [oceanbase]>