This topic describes how to deploy OceanBase Admin Toolkit (OAT) in a Docker container.
Prerequisites
The operating system of the server where OAT is to be installed meets the requirements. For more information, see Configure servers.
You have installed and started Docker. Docker Community Edition 17.03 or later is recommended.
Notice
If you use the oat-all-in-one installation package to deploy OAT, the
install.shscript in the package will automatically install Docker.The default port
7000of OAT is not occupied.You have the
rootuser privileges on the server.
Procedure
Solution 1: Use the oat-all-in-one installation package to deploy OAT
Notice
Before you use the oat-all-in-one installation package to deploy OAT, we recommend that you run the setenforce 0 command on your client to disable Security-Enhanced Linux (SELinux).
Run the
scpcommand to upload the oat-all-in-one installation package to the server.In the following command,
oat_server_ipspecifies the IP address of the server where OAT is deployed.oat_directoryspecifies the directory where the installation package is stored.oat_xxx.tarspecifies the name of the installation package.scp <oat_directory/oat-all-in-one-xxx.tar> <oat_server_user>@<oat_server_ip>:oat_directoryHere is an example:
[root@xxx /home/admin/rpm]# scp oat-all-in-one-x86-411.tar admin@xxx.xxx.xxx.xxx:/home/admin/rpm admin@xxx.xxx.xxx.xxx's password: oat-all-in-one-x86-411.tar 100% 1649MB 401.9MB/s 00:04Decompress the oat-all-in-one installation package.
Here is an example:
[root@xxx /home/admin/rpm]# tar -xf oat-all-in-one-x86-411.tarRun the
install.shinstallation script.Run the
install.shinstallation script in theoat-all-in-one-x86/directory.sh oat-all-in-one-x86/install.shIf Docker is not installed in your environment, this command automatically installs Docker, deploys OAT, and scans for existing images and tool packages.
Perform the following steps in sequence as prompted:
- Specify the root directory of Docker. The default value is
/docker. If Docker is already installed, you do not need to specify this parameter. - Specify the path of the OAT data directory. The default value is
/oat_data. - Specify the HTTP listening port for OAT. The default value is
7000. - Specify the database port for OAT. The default value is
3306. - Set the initial login password for the OAT administrator account.
- Use the returned URL to access OAT and verify the availability of the OAT service.
Here is an example:
[root@xxx /home/admin/rpm]# sh oat-all-in-one-x86/install.shFor example, perform the following steps as prompted:
Use the default root directory of Docker and press Enter.
Before installation, please set the config below: Input the docker root dir: /dockerSet the path of the OAT data directory to
/home/admin/oat_dataand press Enter.Input the OAT data dir: /home/admin/oat_dataUse the default HTTP listening port for OAT and press Enter.
Input the OAT HTTP listen port: 7000Use the default database port for OAT and press Enter.
Input the OAT database port: 3306Set the initial login password for the OAT administrator account and press Enter.
Input the OAT admin user password(login password): ******Use the returned URL to access OAT and verify the availability of the OAT service.
The return result is as follows:
Start prepare docker Docker is already exists, start check... Already installed docker check healthy, skip install docker Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. Start prepare OAT Loaded image: reg.docker.alibaba-inc.com/oceanbase/oat:4.1.1_20230512_x86 f4f5dbe127f62f9ec016dabfc6b1b272da2dd7794c255aed9e335cb83192ad2b check OAT url http://127.0.0.1:7000/hc curl: (7) Failed connect to 127.0.0.1:7000; Connection refused OAT API not ready, please wait, sleep 5s retry... curl: (7) Failed connect to 127.0.0.1:7000; Connection refused OAT API not ready, please wait, sleep 5s retry... curl: (7) Failed connect to 127.0.0.1:7000; Connection refused OAT API not ready, please wait, sleep 5s retry... curl: (7) Failed connect to 127.0.0.1:7000; Connection refused OAT API not ready, please wait, sleep 5s retry... OAT API ready Copy images and binary_packages to OAT data dir Trigger OAT scan api to find images and binary_packages Trigger scan task success, please visit OAT web site and wait for scan task finished OAT is ready for visit url is: http://xxx.xxx.xxx.xxx:7000 user/password is: ******
- Specify the root directory of Docker. The default value is
Note
- By default, the
install.shscript starts the OAT container in host network mode by using--net host. If you want to use another mode, download the OAT container and start it manually. - By default, the oat-all-in-one installation package for x86 contains only the OAT image and software packages for the x86_64 and Noarch architectures, and the oat-all-in-one installation package for AArch64 contains only the OAT image and software packages for AArch64 and Noarch architectures. If you have only the oat-all-in-one installation package for x86 or AArch64 and you want to use the OAT image and software packages for the AArch64 or x86_64 architecture, download and copy the required OAT image and software packages to the directory to which the OAT container is mounted, and then initiate a scan task to add the packages.
Solution 2: Use the OAT Docker image to deploy OAT independently
Run the
scpcommand to upload the OAT installation package to the server.In the following command,
oat_server_ipspecifies the IP address of the server where OAT is deployed.oat_directoryspecifies the directory where the installation package is stored.oat_xxx.tarspecifies the name of the installation package.scp <oat_directory/oat_xxx.tar> <oat_server_user>@<oat_server_ip>:oat_directoryHere is an example:
[root@xxx /home/admin/rpm]# scp oat_4.1.0_20230331_x86.tgz admin@xxx.xxx.xxx.xxx:/home/admin/rpm admin@xxx.xxx.xxx.xxx's password: oat_4.1.0_20230331_x86.tgz 100% 438MB 4.3MB/s 01:41Mount the OAT directory.
Create a directory named
/data_diron the server to save persistent data of OAT. After the/data_dirdirectory is mounted to the OAT container, OAT will automatically create the/data_dir/logs,/data_dir/images, and/data_dir/dbdirectories respectively for storing OAT system logs, Docker images of related components and products, and database files of OAT. Here is an example:[root@xxx /]# mkdir -p /data_dirLoad the OAT installation package as an image.
Go to the directory where the OAT installation package is stored and run the following commands:
[root@xxx /]# cd oat_directory [root@xxx /oat_directory]# docker load -i oat_xxx.tarHere is an example:
[root@xxx /]# cd /home/admin/rpm [root@xxx /home/admin/rpm]# docker load -i oat_4.1.0_20230331_x86.tgz 06f6bfff6616: Loading layer [==================================================>] 230.8MB/230.8MB e1505344677e: Loading layer [==================================================>] 3.072kB/3.072kB 01ede0eada53: Loading layer [==================================================>] 690.2MB/690.2MB 78073091fd9e: Loading layer [==================================================>] 8.704kB/8.704kB 5d96997aeb89: Loading layer [==================================================>] 232.8MB/232.8MB 17fa9a0a477e: Loading layer [==================================================>] 156.1MB/156.1MB Loaded image: reg.docker.alibaba-inc.com/oceanbase/oat:4.1.0_20230331_x86Run the
docker imagescommand to obtain the tag of the OAT image.Note
The following command applies only to scenarios where only one OAT installation package is loaded locally. If multiple installation packages are loaded, you can run the
docker imagescommand to view the display content and connect the first two columns with a colon (:).oat_image=`docker images | grep oat | awk '{printf $1":"$2"\n"}'`Here is an example:
[root@xxx /home/admin/rpm]# oat_image=`docker images | grep oat | awk '{printf $1":"$2"\n"}'`Run the
docker runcommand to start OAT.In the following example,
$oat_imageis the tag of the OAT image.docker run -d --net host --name oat -v /data_dir:/data --restart on-failure:5 $oat_imageNote
- The default HTTP listening port of OAT is
7000. You can specify the-e HTTP_PORT=7001parameter to modify the port. - You can specify the
-e OAT_INITIAL_ADMIN_PASSWORD=xxxparameter to change the password of OAT. - By default, the built-in MariaDB of OAT listens on port
3306. You can specify the-e DB_PORT=3307parameter to modify the port. - We recommend that you start OAT by specifying the
--net hostparameter, because a container started in bridge mode can be affected bydocker0bridge failures or theip_forwardparameter of the operating system.
Here is an example:
[root@xxx /home/admin/rpm]# docker run -d --net host --name oat -v /data_dir:/data --restart on-failure:5 `docker images | grep oat | awk '{printf $1":"$2"\n"}'` 79978776c4d478d36b0b61d6ccfb186d39dbd2d29695a27937d0fc654b58ffb9- The default HTTP listening port of OAT is
What to do next
After you deploy OAT, you need to log in to OAT to check whether the deployment is successful.
Enter the access address of OAT in the address bar of your browser and press Enter.
The OAT access address is in the format of
http://oat_server_ip:7000.Here,
oat_server_ipspecifies the IP address of the server where OAT is deployed.If the login page appears, OAT is installed and started.
On the login page that appears, log in to OAT by using the
adminaccount.Notice
You can contact OceanBase Technical Support to obtain the default password of the default account
adminof OAT. To ensure account security, change the password upon the first login.Set a password and activate the account.
After you log in to OAT with the default password of the
adminaccount, set a password to activate the account.
References
For more information about how to install OAT, see Install OAT.