This topic describes how to deploy OceanBase Admin Toolkit (OAT) by using a Docker image.
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. Therefore, you do not need to install Docker separately.The default port
7000of OAT is not occupied.You have the
rootuser permissions on the server.
Procedure
Solution 1: Use the oat-all-in-one installation package to deploy OAT
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.
Confirm the following information 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 logon 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.shSet the following parameters 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 logon 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 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: XXXXX/******
- Specify the root directory of Docker. The default value is
Note
- By default, the
install.shscript starts the OAT container by using the--net host(host network) mode. To use another network mode, download the OAT container, manually start it, and select the desired network mode. - By default,
oat-all-in-onefor x86 contains only the OAT image and software packages for the x86_64 and Noarch architectures, andoat-all-in-onefor AArch64 contains only the OAT image and software packages for AArch64 and Noarch. If you have onlyoat-all-in-onefor 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 an OAT container, OAT automatically creates the/data_dir/logs,/data_dir/images, and/data_dir/dbdirectories to store OAT system logs, Docker images of components and products, and OAT database files, respectively. 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 execute the following statement:
[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 to the server 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 change the listening port by setting-e HTTP_PORT=7001. - You can change the password of OAT by setting
-e OAT_INITIAL_ADMIN_PASSWORD=xxx. - MariaDB is built in OAT for data storage. The default listening port of the database is
3306. You can change the port by setting-e DB_PORT=3307. - We recommend that you start OAT by using the
--net hostoption. This is 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 on 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.
OAT access URL:
http://oat_server_ip:7000.In the preceding URL,
oat_server_ipindicates the IP address of the server where OAT is installed.If the logon page appears, OAT is installed and started.
On the logon page that appears, log on to OAT by using the admin account.
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 logon.Set a password and activate the account.
After you log on to OAT with the default password of the
adminaccount, set a password to activate the account.