quick-start-en.md 7.8 KB
Newer Older
A
Amber Zhang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
# Quick Start

This guide navigates you through the installation of OceanBase Database by taking standalone OceanBase Database as an example.

## Prerequisites

Your server has access to the Internet, and the software and hardware meet the following requirements:

| Item | Description |
| ---- | --- |
| System | Red Hat Enterprise Linux Server 7.2 Release with the Linux kernel version being 3.10.0 or later<br /> CentOS Linux 7.2 Release with the Linux kernel version being 3.10.0 or later |
| Memory | At least 16 GB<br /> 64 GB or larger is recommended |
| Disk type | SSDs are recommended |
| Disk space | At least 100 GB |
| File system | EXT4 or XFS |
| NIC | 1 Gbit/s or above |

> **NOTE:** The following description is based on a CentOS Linux 7.2 image in the x86 architecture. The installation procedure may be slightly different in other environments.

## Step 1: Download and install OBD

We recommend that you use OceanBase Deployer (OBD). It is the fastest tool for the deployment of OceanBase Database. Take the following steps to download and install OBD:

### Option 1: Install OBD by using Yum repositories

If your server has access to the Internet and supports third-party software from YUM repositories, you can run the following command to install OBD:

```bash
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
```

### Option 2: Install ODB offline

1. Download the RPM package of OBD.

2. Run the following command to install OBD.

   ```bash
   yum install -y ob-deploy-1.0.0-1.el7.x86_64.rpm
   source /etc/profile.d/obd.sh
   ```

## (Optional) Step 2: Download the OceanBase Database installation package

You may skip this step if your server has access to the Internet, because when you run the `obd cluster deploy` command, OBD checks whether the OceanBase Database installation package exists on your target server. If the package is not found, OBD automatically downloads it from YUM repositories.

If your server does not have Internet access, take the following steps to install the software offline:

1. Run the following command to download the OceanBase Database installation package:

   ```bash
   # Create a directory to store the package.
   mkdir rpm
   cat > rpm_list <<EOF
   oceanbase-ce-3.1.0-1.el7.x86_64.rpm
   oceanbase-ce-libs-3.1.0-1.el7.x86_64.rpm
   obproxy-3.1.0-1.el7.x86_64.rpm
   EOF

   wget -B https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64/ -i rpm_list -P rpm
   ```

   **NOTE:** The installation packages in the preceding example may not be the latest version. We recommend that you download the latest installation packages. For more information, see [OceanBase Database Releases](https://github.com/oceanbase/oceanbase/releases).

2. Run the following command to copy the package to your central control server:

   ```bash
   scp -r rpm <user>@<your-machine-ip>
   ```

3. Run the following command on the central control server to load the package to the local image:

   ```bash
   cd ~/rpm
   obd mirror clone *.rpm
   ```

## Step 3: Deploy OceanBase Database

This section describes how to use OBD to deploy OceanBase Database. Take the following steps:

1. Download the corresponding configuration template from GitHub. These are some sample configurations:

   - If you want to install OceanBase Database on your central control server, download the [local installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml).
   - If you want to install OceanBase Database on a standalone server other than the central control server, download the [standalone installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-single-example.yaml).
   - If you want to install OceanBase Database on multiple servers other than the central control server, download the [distributed installation configuration file](https://github.com/oceanbase/obdeploy/blob/master/example/mini-distributed-example.yaml)
   > **NOTE:** The following example describes how to modify the configuration file in local installation mode. You must select the configuration template that corresponds to your installation mode.

2. If you want to install OceanBase Database on a server other than the central control server, you need to add relevant configurations for SSH remote access at the beginning of the configuration file.

   ```yaml
   user:
     username: <Your account name.>
     password: <Your logon password.>
     key_file: <The path of your private key.>
   ```

   `username` specifies the username used to log on to the target server. Make sure that your username has access to `home_path`.
   > **NOTE:** Generally, you can use only the password or the private key to log on. If you specify both of them, `password` is considered as the password of your private key.

3. (Optional) Modify the IP address in the configuration file.

   ```yaml
   oceanbase-ce:
     servers:
       - name: z1
       # Please don't use hostname, only IP can be supported
       ip: 11.166.80.01
   ```

4. Modify the `devname` and `home_path` variables in the configuration file.

   ```yaml
   oceanbase-ce:
     global:
       home_path: <your_observer_work_path>
       # Please set devname as the network adaptor's name whose ip is in the setting of severs.
       # if set severs as "127.0.0.1", please set devname as "lo"
       # if current ip is 192.168.1.10, and the ip's network adaptor'sname is "eth0", please use "eth0"
       devname: bond0
   ```

## Step 4: Connect to OceanBase Database

Take the following steps to deploy and start the OceanBase Database instance:

1. Run the following command to deploy the cluster:

   ```bash
   obd cluster deploy <deploy_name> -c <deploy_config_path>
   ```

   `deploy_name` specifies the name of the cluster. You can specify only one unique name for a cluster.

2. Run the following command to start the cluster:

   ```bash
   obd cluster start <deploy_name>
   ```

3. Run the following command to check the cluster status:

   ```bash
   obd cluster display <deploy_name>
   ```

## Step 5: Connect to OceanBase Database

Take the following steps:

1. Install the OceanBase Database client (OBClient):

   If you have added YUM repositories as the software source on your server, run the following command to install the OBClient:

   ```bash
   sudo yum install -y obclient
   ```

   Otherwise, you need to download the installation package to the server and run the following command to install it offline:

   ```bash
   sudo yum install -y obclient-2.0.0-1.el7.x86_64.rpm
   ```

   **NOTE:** The installation packages in the preceding example may not be the latest version. We recommend that you download the latest installation packages. For more information, see [OceanBase Download Center](https://github.com/oceanbase/oceanbase/releases).

2. Run the following command to connect to OceanBase Database from the OBClient:

   ```bash
   obclient -h<your_ip> -P<observer_mysql_port> -uroot
   ```

   `<your_ip>` specifies the IP address of the server where your OceanBase Database instance is located. By default, the `observer` connects to the OBClient through port `2883`. Use the actual port number if you have changed it.

   The following returned information indicates successful connection:

   ```bash
   Welcome to the MariaDB monitor.  Commands end with ; or \g.
   Your MySQL connection id is 3221546072
   Server version: 5.7.25 OceanBase 3.1.0 (r1-) (Built Apr  7 2021 08:14:49)

   Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

   MySQL [(none)]>
   ```

## (Optional) Step 6: Create a tenant

For more information, see [Create a user tenant](https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/create-a-user-tenant)