Skip to content

Latest commit

 

History

History
319 lines (207 loc) · 16.2 KB

100.quickly-experience-oceanbase-for-community.md

File metadata and controls

319 lines (207 loc) · 16.2 KB

Get started with OceanBase Database

This topic describes how to deploy OceanBase Database in a demo environment, a cluster, or a container for quick hands-on experience.

Notice

  • The deployment solutions outlined in this topic are only suitable for quick hands-on with OceanBase Database and are not intended for use in production environments. To deploy OceanBase Database in a production environment, see Deployment overview.

  • The solutions for deploying OceanBase Database in a demo environment or a cluster are applicable to both OceanBase Database Enterprise Edition and OceanBase Database Community Edition. However, the solution for deploying OceanBase Database in a container applies only to the Community Edition.

Background

OceanBase Database provides an all-in-one installation package since V4.0.0. You can use this package to install OceanBase Deployer (OBD), OceanBase Database, OceanBase Database Proxy (ODP), OceanBase Agent (OBAgent), Grafana, and Prometheus at a time. Since V4.1.0, you can also use the all-in-one package to install OceanBase Cloud Platform (OCP) Express. You can choose to install some or all of the components as needed.

About the components

  • OBD

    OBD is a tool for installing and deploying OceanBase clusters. For more information, see OBD Documentation.

  • ODP

    ODP is a high-performance reverse proxy service designed for OceanBase Database. For more information, see ODP Documentation.

  • OCP Express

    OCP Express is a web-based management tool for OceanBase Database V4.x. Integrated with an OceanBase cluster, OCP Express allows you to view key performance metrics of the cluster and perform basic database management operations on the cluster.

  • OBAgent

    OBAgent is a data monitoring and collection framework for OceanBase Database. The framework supports both pushing and pulling modes for data collection in different scenarios.

  • Grafana

    Grafana is an open-source data visualization tool that visualizes various metrics in data sources to help you understand the system running status and performance. For more information, visit the official website of Grafana.

  • Prometheus

    Prometheus is an open source service monitoring system and time series database. It provides common data models and APIs for fast data collection, storage, and query. For more information, visit the official website of Prometheus.

Deployment solutions

Three deployment solutions are provided for you to quickly get started with OceanBase Database. You can choose a solution based on the actual situation.

  • Solution 1: Deploy OceanBase Database in a demo environment

    If you have only one server, you can quickly build a demo environment to deploy OceanBase Database. The demo database provides basic features for you to quickly learn about OceanBase Database, but does not support distributed capabilities or high availability. Therefore, long-term use is not recommended. For more information, see Solution 1: Deploy OceanBase Database in a demo environment.

  • Solution 2: Deploy OceanBase Database in a cluster

    You can choose this solution if you want to learn more about the distributed architecture and features of OceanBase Database. The cluster provides distributed capabilities and high availability apart from complete database features. To use this solution, you must have three hosts, each of which has four CPU cores, 10 GB of memory, and 50 GB of disk space. For more information, see Solution 2: Deploy OceanBase Database in a cluster.

  • Solution 3: Deploy OceanBase Database in a container (applicable only to the Community Edition)

    You can choose this solution if you want to deploy and manage OceanBase Database in a container. This solution has not been verified by large-scale practices and therefore is not recommended. For more information, see Solution 3: Deploy OceanBase Database in a container.

Prerequisites

Your software and hardware environments meet the following requirements.

Item Description
OS
  • Alibaba Cloud Linux 2/3 (Linux kernel 3.10.0 or later)
  • Anolis OS 8.X (Linux kernel 3.10.0 or later)
  • Red Hat Enterprise Linux Server 7.X and 8.X (Linux kernel V3.10.0 or later)
  • CentOS Linux 7.X and 8.X (Linux kernel V3.10.0 or later)
  • Debian 9.X or later (Linux kernel 3.10.0 or later)
  • Ubuntu 20.X or later (Linux kernel 3.10.0 or later)
  • SUSE/OpenSUSE 15.X or later (Linux kernel 3.10.0 or later)
  • KylinOS V10
  • Unity Operating System (UOS) 1020a/1021a/1021e/1001c
  • NFSChina V4.0 or later
  • Inspur KOS V5.8
CPU At least two cores or preferably four cores or more
Memory At least 8 GB or preferably 16 GB or more
Disk type SSD
Disk space At least 54 GB
File system EXT4 or XFS. Choose XFS when the data volume exceeds 16 TB.
All-in-one package V4.1.0 or later
Docker To deploy OceanBase Database in a Docker container, install and start Docker in advance. For more information, see Get Docker.

Note

The following describes the deployment of OceanBase Database on an x86-based CentOS Linux 7.9 platform. The procedure may be different on other OS platforms.

Solution 1: Deploy OceanBase Database in a demo environment

If you have only one server available, you can run the obd demo command to quickly deploy a standalone OceanBase Database by following the procedure described in this section.

Step 1: Download and install the all-in-one package

  1. Download the all-in-one package and upload it to any directory on your server.

    • For OceanBase Database Enterprise Edition, contact the Technical Support to obtain the all-in-one package.

    • For OceanBase Database Community Edition, download the latest all-in-one package from OceanBase Download Center.

  2. In the directory where the package is located, run the following commands to decompress and install the package:

    [admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
    [admin@test001 ~]$ cd oceanbase-all-in-one/bin/
    [admin@test001 bin]$ ./install.sh
    [admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh

Step 2: Deploy OceanBase Database on a single server

  1. Run either of the following commands for quick deployment.

    • Enterprise Edition

      [admin@test001 ~]$ obd demo -c oceanbase,obproxy,obagent,prometheus,grafana
    • Community Edition

      [admin@test001 ~]$ obd demo

    By default, the obd demo command deploys OceanBase Database and its components (which are ODP, OBAgent, Grafana, and Prometheus) with minimum specifications and then starts them in the home directory of the current user. The name of the deployed cluster is fixed to demo in OBD. For more information about custom deployment, see Quick deployment command.

    You can use OBD commands to manage OceanBase Database. For more information about the commands, see Cluster commands.

    Note

    If you install Grafana or Prometheus, its access address is returned in the command output. On Alibaba Cloud or other cloud environments, the program may fail to obtain a public IP address but return an intranet IP address. You must use a correct public IP address.

  2. Connect to OceanBase Database from OBClient.

    • Directly connect to the database through port 2881

      [admin@test001 ~]$ obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -A
    • Connect to the database in proxy mode through ODP

      [admin@test001 ~]$ obclient -h127.0.0.1 -P2883 -uroot@sys -Doceanbase -A

Solution 2: Deploy OceanBase Database in a cluster

If you have multiple servers available, you can run the obd web command to start the GUI of OBD and deploy a distributed OceanBase cluster on the GUI.

Step 1: Download and install the all-in-one package

  1. Download the all-in-one package and upload it to any directory on your server.

    • For OceanBase Database Enterprise Edition, contact the Technical Support to obtain the all-in-one package.

    • For OceanBase Database Community Edition, download the latest all-in-one package from OceanBase Download Center.

  2. In the directory where the package is located, run the following commands to decompress and install the package:

    [admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
    [admin@test001 ~]$ cd oceanbase-all-in-one/bin/
    [admin@test001 bin]$ ./install.sh
    [admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh

Step 2: Deploy OceanBase Database on the GUI

  1. Run the obd web command in your CLI to start the GUI of OBD. Visit the URL in the output and click Try Now on the page displayed to start deployment.

    [admin@test001 ~]$ obd web
    start OBD WEB in 0.0.0.0:8680
    please open http://172.xx.xxx.233:8680

    Note

    • The default port in the URL is 8680. You can use the obd web -p <PORT> command to specify a port.

    • On Alibaba Cloud or other cloud environments, the program may fail to obtain a public IP address but return an intranet IP address. You must use a correct public IP address to access the GUI.

    • The obd web command is bound to 0.0.0.0. In the case of multi-NIC deployment, you can access the GUI through any accessible IP address.

  2. On the Deployment Configuration page, modify Cluster Name and Deployment Type. You can also retain the default values. Click Next to go to the Node Configuration page.

  1. On the Node Configuration page, enter server IP addresses and the password and then click Next to go to the Cluster Configuration page.
  1. On the Cluster Configuration page, specify the deployment mode, password, directory, port, and other information about the cluster. You can also retain the default values. Click Next to go to the Pre-check page.
  1. On the Pre-check page, verify the configuration information and then click Pre-check. If an error code is returned, you can click Auto repair to automatically repair the error, or click Learn more to repair the error by referring to the error code document. After all the errors are repaired, click Re-check to perform a pre-check again.
  1. After the pre-check is passed, click Deploy to start the deployment. If the deployment is successful, the connection strings of the components are displayed. You can copy a connection string to access the corresponding component.
  1. Click Complete.

  2. Connect to OceanBase Database from OBClient or log on to the GUI of OCP Express to manage the cluster.

    • Directly connect to OBServer node 10.10.10.1 of the database through port 2881.

      [admin@test001 ~]$ obclient -h10.10.10.1 -P2881 -uroot@sys -Doceanbase -A
    • Connect to the database in proxy mode through the ODP node 10.10.10.1.

      [admin@test001 ~]$ obclient -h10.10.10.1 -P2883 -uroot@sys -Doceanbase -A

Solution 3: Deploy OceanBase Database in a container

You can deploy OceanBase Database in a Docker container to quickly get started with OceanBase Database.

(Optional) Step 1: Pull the image of OceanBase Database

Run the following commands to pull the image needed by OceanBase Database.

  • Search for images related to OceanBase Database.

    [admin@test001 ~]$ docker search oceanbase
  • Pull the latest image of OceanBase Database.

    [admin@test001 ~]$ docker pull oceanbase/oceanbase-ce

    Note

    By default, the preceding command pulls the latest version of Docker image. You can select a desired image from Docker images as needed.

Step 2: Start an OceanBase Database instance

Run either of the following commands to start an OceanBase Database instance.

  • Deploy an instance with the maximum specifications supported by the container.

    [admin@test001 ~]$ docker run -p 2881:2881 --name obstandalone -e MINI_MODE=0 -d oceanbase/oceanbase-ce
  • Deploy a mini standalone instance.

    [admin@test001 ~]$ docker run -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d oceanbase/oceanbase-ce

It takes 2 to 5 minutes to start an instance. Run the following command. If boot success! is returned, the instance is started.

[admin@test001 ~]$ docker logs obstandalone | tail -1
boot success!

Step 3: Connect to the OceanBase Database instance

The oceanbase-ce image is integrated with OBClient and the default connection script ob-mysql.

$ Log on to the sys tenant of the cluster as the root user
[admin@test001 ~]$ docker exec -it obstandalone ob-mysql sys

$ Log on to the test tenant of the cluster as the root user
[admin@test001 ~]$ docker exec -it obstandalone ob-mysql root

$ Log on to the test tenant of the cluster as the test user
[admin@test001 ~]$ docker exec -it obstandalone ob-mysql test

You can also run the following command to connect to the instance by using OBClient or the MySQL client on your local server:

[admin@test001 ~]$ obclient -uroot@sys -h127.1 -P2881

After the connection is established, the following information is displayed:

[admin@test001 ~]$ 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 3221487727
Server version: OceanBase_CE 4.1.0.0 (r100000192023032010-0265dfc6d00ff4f0ff4ad2710504a18962abaef6) (Built Mar 20 2023 10:12:57)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [oceanbase]>