1、操作系统信息

  1. \[root@localhost ~\]# cat /etc/redhat-release
  2. CentOS Linux release 7.6.1810 (Core)
  3. \[root@localhost ~\]# free -h
  4. total used free shared buff/cache available
  5. Mem: 31G 7.4G 19G 28M 4.7G 23G
  6. Swap: 15G 0B 15G
  7. \[root@localhost ~\]# df -Th
  8. Filesystem Type Size Used Avail Use% Mounted on
  9. /dev/sda3 xfs 184G 13G 172G 7% /
  10. devtmpfs devtmpfs 16G 0 16G 0% /dev
  11. tmpfs tmpfs 16G 0 16G 0% /dev/shm
  12. tmpfs tmpfs 16G 13M 16G 1% /run
  13. tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
  14. /dev/sda1 xfs 297M 157M 140M 53% /boot
  15. tmpfs tmpfs 3.2G 8.0K 3.2G 1% /run/user/42
  16. tmpfs tmpfs 3.2G 52K 3.2G 1% /run/user/1000
  17. tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
  18. overlay overlay 184G 13G 172G 7% /var/lib/docker/overlay2/75b994560a6c064ee11e7c8a0865186ffd1c5ad1e88df29c86ab50f9a884880c/merged

2、安装docker

docker 安装oceanbase - 图1

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

  1. Loaded plugins: fastestmirror, langpacks
  2. Loading mirror speeds from cached hostfile
  3. \* base: mirrors.bupt.edu.cn
  4. \* extras: mirrors.bupt.edu.cn
  5. \* updates: mirrors.bupt.edu.cn
  6. Resolving Dependencies
  7. \--> Running transaction check
  8. \---> Package device-mapper-persistent-data.x86\_64 0:0.7.3-3.el7 will be updated
  9. \---> Package device-mapper-persistent-data.x86\_64 0:0.8.5-3.el7\_9.2 will be an update
  10. \---> Package lvm2.x86\_64 7:2.02.180-8.el7 will be updated
  11. \---> Package lvm2.x86\_64 7:2.02.187-6.el7\_9.5 will be an update
  12. \--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7\_9.5 for package: 7:lvm2-2.02.187-6.el7\_9.5.x86\_64
  13. \---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated
  14. \---> Package yum-utils.noarch 0:1.1.31-54.el7\_8 will be an update
  15. \--> Running transaction check
  16. \---> Package lvm2-libs.x86\_64 7:2.02.180-8.el7 will be updated
  17. \---> Package lvm2-libs.x86\_64 7:2.02.187-6.el7\_9.5 will be an update
  18. \--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7\_9.5 for package: 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64
  19. \--> Running transaction check
  20. \---> Package device-mapper-event.x86\_64 7:1.02.149-8.el7 will be updated
  21. \---> Package device-mapper-event.x86\_64 7:1.02.170-6.el7\_9.5 will be an update
  22. \--> Processing Dependency: device-mapper-event-libs = 7:1.02.170-6.el7\_9.5 for package: 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64
  23. \--> Processing Dependency: device-mapper = 7:1.02.170-6.el7\_9.5 for package: 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64
  24. \--> Running transaction check
  25. \---> Package device-mapper.x86\_64 7:1.02.149-8.el7 will be updated
  26. \--> Processing Dependency: device-mapper = 7:1.02.149-8.el7 for package: 7:device-mapper-libs-1.02.149-8.el7.x86\_64
  27. \---> Package device-mapper.x86\_64 7:1.02.170-6.el7\_9.5 will be an update
  28. \---> Package device-mapper-event-libs.x86\_64 7:1.02.149-8.el7 will be updated
  29. \---> Package device-mapper-event-libs.x86\_64 7:1.02.170-6.el7\_9.5 will be an update
  30. \--> Running transaction check
  31. \---> Package device-mapper-libs.x86\_64 7:1.02.149-8.el7 will be updated
  32. \---> Package device-mapper-libs.x86\_64 7:1.02.170-6.el7\_9.5 will be an update
  33. \--> Finished Dependency Resolution
  34. Dependencies Resolved
  35. \======================================================================================================================
  36. Package Arch Version Repository Size
  37. \======================================================================================================================
  38. Updating:
  39. device-mapper-persistent-data x86\_64 0.8.5-3.el7\_9.2 updates 423 k
  40. lvm2 x86\_64 7:2.02.187-6.el7\_9.5 updates 1.3 M
  41. yum-utils noarch 1.1.31-54.el7\_8 base 122 k
  42. Updating for dependencies:
  43. device-mapper x86\_64 7:1.02.170-6.el7\_9.5 updates 297 k
  44. device-mapper-event x86\_64 7:1.02.170-6.el7\_9.5 updates 192 k
  45. device-mapper-event-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 192 k
  46. device-mapper-libs x86\_64 7:1.02.170-6.el7\_9.5 updates 325 k
  47. lvm2-libs x86\_64 7:2.02.187-6.el7\_9.5 updates 1.1 M
  48. Transaction Summary
  49. \======================================================================================================================
  50. Upgrade 3 Packages (+5 Dependent packages)
  51. Total size: 3.9 M
  52. Downloading packages:
  53. warning: /var/cache/yum/x86\_64/7/updates/packages/device-mapper-event-1.02.170-6.el7\_9.5.x86\_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
  54. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  55. Importing GPG key 0xF4A80EB5:
  56. Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
  57. Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
  58. Package : centos-release-7-6.1810.2.el7.centos.x86\_64 (@anaconda)
  59. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  60. Running transaction check
  61. Running transaction test
  62. Transaction test succeeded
  63. Running transaction
  64. Updating : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 1/16
  65. Updating : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 2/16
  66. Updating : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 3/16
  67. Updating : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 4/16
  68. Updating : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 5/16
  69. Updating : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 6/16
  70. Updating : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 7/16
  71. Updating : yum-utils-1.1.31-54.el7\_8.noarch 8/16
  72. Cleanup : 7:lvm2-2.02.180-8.el7.x86\_64 9/16
  73. Cleanup : yum-utils-1.1.31-50.el7.noarch 10/16
  74. Cleanup : 7:lvm2-libs-2.02.180-8.el7.x86\_64 11/16
  75. Cleanup : 7:device-mapper-event-1.02.149-8.el7.x86\_64 12/16
  76. Cleanup : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 13/16
  77. Cleanup : 7:device-mapper-1.02.149-8.el7.x86\_64 14/16
  78. Cleanup : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 15/16
  79. Cleanup : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 16/16
  80. Verifying : 7:device-mapper-event-1.02.170-6.el7\_9.5.x86\_64 1/16
  81. Verifying : 7:lvm2-libs-2.02.187-6.el7\_9.5.x86\_64 2/16
  82. Verifying : 7:device-mapper-1.02.170-6.el7\_9.5.x86\_64 3/16
  83. Verifying : device-mapper-persistent-data-0.8.5-3.el7\_9.2.x86\_64 4/16
  84. Verifying : 7:device-mapper-event-libs-1.02.170-6.el7\_9.5.x86\_64 5/16
  85. Verifying : 7:lvm2-2.02.187-6.el7\_9.5.x86\_64 6/16
  86. Verifying : 7:device-mapper-libs-1.02.170-6.el7\_9.5.x86\_64 7/16
  87. Verifying : yum-utils-1.1.31-54.el7\_8.noarch 8/16
  88. Verifying : device-mapper-persistent-data-0.7.3-3.el7.x86\_64 9/16
  89. Verifying : 7:lvm2-2.02.180-8.el7.x86\_64 10/16
  90. Verifying : yum-utils-1.1.31-50.el7.noarch 11/16
  91. Verifying : 7:lvm2-libs-2.02.180-8.el7.x86\_64 12/16
  92. Verifying : 7:device-mapper-1.02.149-8.el7.x86\_64 13/16
  93. Verifying : 7:device-mapper-libs-1.02.149-8.el7.x86\_64 14/16
  94. Verifying : 7:device-mapper-event-1.02.149-8.el7.x86\_64 15/16
  95. Verifying : 7:device-mapper-event-libs-1.02.149-8.el7.x86\_64 16/16
  96. Updated:
  97. device-mapper-persistent-data.x86\_64 0:0.8.5-3.el7\_9.2 lvm2.x86\_64 7:2.02.187-6.el7\_9.5
  98. yum-utils.noarch 0:1.1.31-54.el7\_8
  99. Dependency Updated:
  100. device-mapper.x86\_64 7:1.02.170-6.el7\_9.5 device-mapper-event.x86\_64 7:1.02.170-6.el7\_9.5
  101. device-mapper-event-libs.x86\_64 7:1.02.170-6.el7\_9.5 device-mapper-libs.x86\_64 7:1.02.170-6.el7\_9.5
  102. lvm2-libs.x86\_64 7:2.02.187-6.el7\_9.5
  103. Complete!

[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  1. Loaded plugins: fastestmirror, langpacks
  2. adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
  3. grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
  4. repo saved to /etc/yum.repos.d/docker-ce.repo

[root@localhost ~]# yum list docker-ce --showduplicates | sort -r

  1. \* updates: mirrors.bupt.edu.cn
  2. Loading mirror speeds from cached hostfile
  3. Loaded plugins: fastestmirror, langpacks
  4. \* extras: mirrors.bupt.edu.cn
  5. docker-ce.x86\_64 3:20.10.9-3.el7 docker-ce-stable
  6. docker-ce.x86\_64 3:20.10.8-3.el7 docker-ce-stable
  7. docker-ce.x86\_64 3:20.10.7-3.el7 docker-ce-stable
  8. docker-ce.x86\_64 3:20.10.6-3.el7 docker-ce-stable
  9. docker-ce.x86\_64 3:20.10.5-3.el7 docker-ce-stable
  10. docker-ce.x86\_64 3:20.10.4-3.el7 docker-ce-stable
  11. docker-ce.x86\_64 3:20.10.3-3.el7 docker-ce-stable
  12. docker-ce.x86\_64 3:20.10.2-3.el7 docker-ce-stable
  13. docker-ce.x86\_64 3:20.10.1-3.el7 docker-ce-stable
  14. docker-ce.x86\_64 3:20.10.11-3.el7 docker-ce-stable
  15. docker-ce.x86\_64 3:20.10.10-3.el7 docker-ce-stable
  16. docker-ce.x86\_64 3:20.10.0-3.el7 docker-ce-stable
  17. docker-ce.x86\_64 3:19.03.9-3.el7 docker-ce-stable
  18. docker-ce.x86\_64 3:19.03.8-3.el7 docker-ce-stable
  19. docker-ce.x86\_64 3:19.03.7-3.el7 docker-ce-stable
  20. docker-ce.x86\_64 3:19.03.6-3.el7 docker-ce-stable
  21. docker-ce.x86\_64 3:19.03.5-3.el7 docker-ce-stable
  22. docker-ce.x86\_64 3:19.03.4-3.el7 docker-ce-stable
  23. docker-ce.x86\_64 3:19.03.3-3.el7 docker-ce-stable
  24. docker-ce.x86\_64 3:19.03.2-3.el7 docker-ce-stable
  25. docker-ce.x86\_64 3:19.03.15-3.el7 docker-ce-stable
  26. docker-ce.x86\_64 3:19.03.14-3.el7 docker-ce-stable
  27. docker-ce.x86\_64 3:19.03.1-3.el7 docker-ce-stable
  28. docker-ce.x86\_64 3:19.03.13-3.el7 docker-ce-stable
  29. docker-ce.x86\_64 3:19.03.12-3.el7 docker-ce-stable
  30. docker-ce.x86\_64 3:19.03.11-3.el7 docker-ce-stable
  31. docker-ce.x86\_64 3:19.03.10-3.el7 docker-ce-stable
  32. docker-ce.x86\_64 3:19.03.0-3.el7 docker-ce-stable
  33. docker-ce.x86\_64 3:18.09.9-3.el7 docker-ce-stable
  34. docker-ce.x86\_64 3:18.09.8-3.el7 docker-ce-stable
  35. docker-ce.x86\_64 3:18.09.7-3.el7 docker-ce-stable
  36. docker-ce.x86\_64 3:18.09.6-3.el7 docker-ce-stable
  37. docker-ce.x86\_64 3:18.09.5-3.el7 docker-ce-stable
  38. docker-ce.x86\_64 3:18.09.4-3.el7 docker-ce-stable
  39. docker-ce.x86\_64 3:18.09.3-3.el7 docker-ce-stable
  40. docker-ce.x86\_64 3:18.09.2-3.el7 docker-ce-stable
  41. docker-ce.x86\_64 3:18.09.1-3.el7 docker-ce-stable
  42. docker-ce.x86\_64 3:18.09.0-3.el7 docker-ce-stable
  43. docker-ce.x86\_64 18.06.3.ce-3.el7 docker-ce-stable
  44. docker-ce.x86\_64 18.06.2.ce-3.el7 docker-ce-stable
  45. docker-ce.x86\_64 18.06.1.ce-3.el7 docker-ce-stable
  46. docker-ce.x86\_64 18.06.0.ce-3.el7 docker-ce-stable
  47. docker-ce.x86\_64 18.03.1.ce-1.el7.centos docker-ce-stable
  48. docker-ce.x86\_64 18.03.0.ce-1.el7.centos docker-ce-stable
  49. docker-ce.x86\_64 17.12.1.ce-1.el7.centos docker-ce-stable
  50. docker-ce.x86\_64 17.12.0.ce-1.el7.centos docker-ce-stable
  51. docker-ce.x86\_64 17.09.1.ce-1.el7.centos docker-ce-stable
  52. docker-ce.x86\_64 17.09.0.ce-1.el7.centos docker-ce-stable
  53. docker-ce.x86\_64 17.06.2.ce-1.el7.centos docker-ce-stable
  54. docker-ce.x86\_64 17.06.1.ce-1.el7.centos docker-ce-stable
  55. docker-ce.x86\_64 17.06.0.ce-1.el7.centos docker-ce-stable
  56. docker-ce.x86\_64 17.03.3.ce-1.el7 docker-ce-stable
  57. docker-ce.x86\_64 17.03.2.ce-1.el7.centos docker-ce-stable
  58. docker-ce.x86\_64 17.03.1.ce-1.el7.centos docker-ce-stable
  59. docker-ce.x86\_64 17.03.0.ce-1.el7.centos docker-ce-stable
  60. \* base: mirrors.bupt.edu.cn
  61. Available Packages

docker 安装oceanbase - 图2

[root@localhost ~]# yum install docker-ce-19.03.5 docker-ce-cli-19.03.5 containerd.io

  1. Loaded plugins: fastestmirror, langpacks
  2. Loading mirror speeds from cached hostfile
  3. \* base: mirrors.bupt.edu.cn
  4. \* extras: mirrors.bupt.edu.cn
  5. \* updates: mirrors.bupt.edu.cn
  6. Resolving Dependencies
  7. \--> Running transaction check
  8. \---> Package containerd.io.x86\_64 0:1.4.12-3.1.el7 will be installed
  9. \--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.12-3.1.el7.x86\_64
  10. \---> Package docker-ce.x86\_64 3:19.03.5-3.el7 will be installed
  11. \---> Package docker-ce-cli.x86\_64 1:19.03.5-3.el7 will be installed
  12. \--> Running transaction check
  13. \---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7\_8 will be installed
  14. \--> Finished Dependency Resolution
  15. Dependencies Resolved
  16. \======================================================================================================================
  17. Package Arch Version Repository Size
  18. \======================================================================================================================
  19. Installing:
  20. containerd.io x86\_64 1.4.12-3.1.el7 docker-ce-stable 28 M
  21. docker-ce x86\_64 3:19.03.5-3.el7 docker-ce-stable 24 M
  22. docker-ce-cli x86\_64 1:19.03.5-3.el7 docker-ce-stable 39 M
  23. Installing for dependencies:
  24. container-selinux noarch 2:2.119.2-1.911c772.el7\_8 extras 40 k
  25. Transaction Summary
  26. \======================================================================================================================
  27. Install 3 Packages (+1 Dependent package)
  28. Total download size: 92 M
  29. Installed size: 381 M
  30. Is this ok \[y/d/N\]: y
  31. Downloading packages:
  32. (1/4): container-selinux-2.119.2-1.911c772.el7\_8.noarch.rpm | 40 kB 00:00:00
  33. warning: /var/cache/yum/x86\_64/7/docker-ce-stable/packages/containerd.io-1.4.12-3.1.el7.x86\_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
  34. Public key for containerd.io-1.4.12-3.1.el7.x86\_64.rpm is not installed
  35. (2/4): containerd.io-1.4.12-3.1.el7.x86\_64.rpm | 28 MB 00:00:06
  36. (3/4): docker-ce-19.03.5-3.el7.x86\_64.rpm | 24 MB 00:00:07
  37. (4/4): docker-ce-cli-19.03.5-3.el7.x86\_64.rpm | 39 MB 00:00:05
  38. \----------------------------------------------------------------------------------------------------------------------
  39. Total 8.2 MB/s | 92 MB 00:00:11
  40. Retrieving key from https://download.docker.com/linux/centos/gpg
  41. Importing GPG key 0x621E9F35:
  42. Userid : "Docker Release (CE rpm) <docker@docker.com>"
  43. Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
  44. From : https://download.docker.com/linux/centos/gpg
  45. Is this ok \[y/N\]: y
  46. Running transaction check
  47. Running transaction test
  48. Transaction test succeeded
  49. Running transaction
  50. Installing : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 1/4
  51. Installing : containerd.io-1.4.12-3.1.el7.x86\_64 2/4
  52. Installing : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4
  53. Installing : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4
  54. Verifying : containerd.io-1.4.12-3.1.el7.x86\_64 1/4
  55. Verifying : 2:container-selinux-2.119.2-1.911c772.el7\_8.noarch 2/4
  56. Verifying : 1:docker-ce-cli-19.03.5-3.el7.x86\_64 3/4
  57. Verifying : 3:docker-ce-19.03.5-3.el7.x86\_64 4/4
  58. Installed:
  59. containerd.io.x86\_64 0:1.4.12-3.1.el7 docker-ce.x86\_64 3:19.03.5-3.el7 docker-ce-cli.x86\_64 1:19.03.5-3.el7
  60. Dependency Installed:
  61. container-selinux.noarch 2:2.119.2-1.911c772.el7\_8
  62. Complete!

[root@localhost ~]# docker version

docker 安装oceanbase - 图3

  1. Client: Docker Engine - Community
  2. Version: 19.03.5
  3. API version: 1.40
  4. Go version: go1.12.12
  5. Git commit: 633a0ea
  6. Built: Wed Nov 13 07:25:41 2019
  7. OS/Arch: linux/amd64
  8. Experimental: false
  9. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[root@localhost ~]# docker info

  1. Client:
  2. Debug Mode: false
  3. Server:
  4. ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  5. errors pretty printing info

[root@localhost ~]# systemctl start docker [root@localhost ~]# systemctl status docker

  1. docker.service - Docker Application Container Engine
  2. Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  3. Active: active (running) since Sat 2021-12-04 20:20:30 PST; 4s ago
  4. Docs: https://docs.docker.com
  5. Main PID: 24363 (dockerd)
  6. Tasks: 24
  7. Memory: 48.7M
  8. CGroup: /system.slice/docker.service
  9. └─24363 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  10. Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080143468-08:00" level=info msg...grpc
  11. Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080167167-08:00" level=info msg...grpc
  12. Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.080177798-08:00" level=info msg...grpc
  13. Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.118578486-08:00" level=info msg...rt."
  14. Dec 04 20:20:29 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:29.666832705-08:00" level=info msg...ess"
  15. Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.247902471-08:00" level=info msg...ne."
  16. Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.279908386-08:00" level=info msg...03.5
  17. Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.280111055-08:00" level=info msg...ion"
  18. Dec 04 20:20:30 localhost.localdomain dockerd\[24363\]: time="2021-12-04T20:20:30.310555121-08:00" level=info msg...ock"
  19. Dec 04 20:20:30 localhost.localdomain systemd\[1\]: Started Docker Application Container Engine.
  20. Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]# docker search oceanbase

  1. NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  2. oceanbase/oceanbase-xe OceanBase Database 2.2 Express Edition 3
  3. oceanbase/obce-mini obce-mini is a mini standalone test image fo 2
  4. obpilot/oceanbase-ce 3 steps to run an OceanBase-CE docker in you 2
  5. zibuyu886/oceanbase-ce-cluster OceanBase ce cluster 1
  6. oceanbase/oceanbase-ce OceanBase is open source now. This is the do 1
  7. huweijie/oceanbase-ce-deploy 0
  8. oceanbase/centos7 0
  9. superbigfu/oceanbase 0
  10. hongweiqin/anolisos-oceanbase A tentative deploy of oceanbase. 0
  11. stutiredboy/centos\_ob Build environment for OceanBase 3.1 CE. Crea 0

3、下载镜像

docker 安装oceanbase - 图4

[root@localhost ~]# docker pull obpilot/oceanbase-ce

  1. Using default tag: latest
  2. latest: Pulling from obpilot/oceanbase-ce
  3. 7a0437f04f83: Pull complete
  4. 615dc48ac9f1: Pull complete
  5. b10c1cdae3af: Pull complete
  6. 4f4fb700ef54: Pull complete
  7. c0f6c94a6a6a: Pull complete
  8. 792630f35e24: Pull complete
  9. Digest: sha256:7ac28415cf27ba19cb47acb67a55ebf9848ad73a63d80b7e2e85d653233dbaeb
  10. Status: Downloaded newer image for obpilot/oceanbase-ce:latest
  11. docker.io/obpilot/oceanbase-ce:latest

4、查看镜像

  1. [root@localhost ~]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. obpilot/oceanbase-ce latest 943379e0b05b 2 days ago 2.25GB

5、运行容器

  1. [root@localhost ~]# docker run -itd -m 40G -p 2881:2881 -p 2883:2883 --name oceanbase-ce obpilot/oceanbase-ce:latest
  2. 213992b864c831141e12fc269721fc5bb9d3a003001c2eeb6a65931d4bca4883

6、查看运行状态

  1. [root@localhost ~]# docker ps -a
  2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  3. 213992b864c8 obpilot/oceanbase-ce:latest "/bin/bash" 7 seconds ago Up 6 seconds 0.0.0.0:2881->2881/tcp, 0.0.0.0:2883->2883/tcp oceanbase-ce

7、进入容器

[root@localhost ~]# docker exec -it oceanbase-ce bash

8、启动ob服务

  1. [admin@213992b864c8 ~\]obd cluster list
  2. +−−−−−−−−+|ClusterList|+−−−−−−−−+
  3. |Name|ConfigurationPath|Status(Cached)|+−−−−−−−−
  4. obdemo|/home/admin/.obd/cluster/obdemo|deployed|+−−−−−
  5. [admin@213992b864c8 \]ls
  6. bmsql.sql obproxy oceanbase-ce readme.md

[admin@213992b864c8 ~]$ obd cluster start obdemo

docker 安装oceanbase - 图5

9、查看ob集群运行状态

[admin@213992b864c8 ~]$ obd cluster display obdemo docker 安装oceanbase - 图6

10、进入集群测试

[admin@213992b864c8 ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase docker 安装oceanbase - 图7

  1. [admin@213992b864c8 ~]$ obclient -h127.1 -uroot@sys#obce-single -P2883 -prootPWD123 -c -A oceanbase
  2. Welcome to the OceanBase. Commands end with ; or \g.
  3. Your MySQL connection id is 4
  4. Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)
  5. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  6. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  7. MySQL [oceanbase]> show databases;
  8. +--------------------+
  9. | Database |
  10. +--------------------+
  11. | oceanbase |
  12. | information_schema |
  13. | mysql |
  14. | SYS |
  15. | LBACSYS |
  16. | ORAAUDITOR |
  17. | test |
  18. +--------------------+
  19. 7 rows in set (0.004 sec)
  20. MySQL [oceanbase]> SELECT * FROM __all_server;
  21. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  22. | gmt_create | gmt_modified | svr_ip | svr_port | id | zone | inner_port | with_rootserver | status | block_migrate_in_time | build_version | stop_time | start_service_time | first_sessid | with_partition | last_offline_time |
  23. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  24. | 2021-12-05 12:34:50.806137 | 2021-12-05 12:35:06.704563 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:52:05) | 0 | 1638678904706946 | 0 | 1 | 0 |
  25. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  26. 1 row in set (0.008 sec)
  27. MySQL [oceanbase]> SELECT * FROM __all_server;
  28. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  29. | gmt_create | gmt_modified | svr_ip | svr_port | id | zone | inner_port | with_rootserver | status | block_migrate_in_time | build_version | stop_time | start_service_time | first_sessid | with_partition | last_offline_time |
  30. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  31. | 2021-12-05 12:34:50.806137 | 2021-12-05 12:35:06.704563 | 127.0.0.1 | 2882 | 1 | zone1 | 2881 | 1 | active | 0 | 3.1.1_4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e(Oct 21 2021 10:52:05) | 0 | 1638678904706946 | 0 | 1 | 0 |
  32. +----------------------------+----------------------------+-----------+----------+----+-------+------------+-----------------+--------+-----------------------+------------------------------------------------------------------------+-----------+--------------------+--------------+----------------+-------------------+
  33. 1 row in set (0.001 sec)
  34. MySQL [oceanbase]> SELECT svr_ip,svr_port, cpu_total, mem_total/1024/1024/1024, disk_total/1024/1024/1024, zone FROM __all_virtual_server_stat;
  35. +-----------+----------+-----------+--------------------------+---------------------------+-------+
  36. | svr_ip | svr_port | cpu_total | mem_total/1024/1024/1024 | disk_total/1024/1024/1024 | zone |
  37. +-----------+----------+-----------+--------------------------+---------------------------+-------+
  38. | 127.0.0.1 | 2882 | 14 | 4.000000000000 | 5.000000000000 | zone1 |
  39. +-----------+----------+-----------+--------------------------+---------------------------+-------+
  40. 1 row in set (0.006 sec)
  41. MySQL [oceanbase]> SELECT sum(c.max_cpu), sum(c.max_memory)/1024/1024/1024 FROM __all_resource_pool as a, __all_unit_config AS c WHERE a.unit_config_id=c.unit_config_id;
  42. +----------------+----------------------------------+
  43. | sum(c.max_cpu) | sum(c.max_memory)/1024/1024/1024 |
  44. +----------------+----------------------------------+
  45. | 5 | 1.199999999255 |
  46. +----------------+----------------------------------+
  47. 1 row in set (0.005 sec)
  48. MySQL [oceanbase]> CREATE RESOURCE UNIT unitsixlens max_cpu = 4, max_memory = '8G', min_memory = '8G', max_iops = 10000, min_iops = 10000, max_session_num = 30000, max_disk_size = '4G';
  49. Query OK, 0 rows affected (0.009 sec)
  50. MySQL [oceanbase]> SELECT * FROM __all_unit_config;
  51. +----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
  52. | gmt_create | gmt_modified | unit_config_id | name | max_cpu | min_cpu | max_memory | min_memory | max_iops | min_iops | max_disk_size | max_session_num |
  53. +----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
  54. | 2021-12-05 12:35:03.074942 | 2021-12-05 12:35:03.074942 | 1 | sys_unit_config | 5 | 2.5 | 1288490188 | 1073741824 | 10000 | 5000 | 5368709120 | 9223372036854775807 |
  55. | 2021-12-05 12:37:33.515276 | 2021-12-05 12:37:33.515276 | 1001 | unitsixlens | 4 | 4 | 8589934592 | 8589934592 | 10000 | 10000 | 4294967296 | 30000 |
  56. +----------------------------+----------------------------+----------------+-----------------+---------+---------+------------+------------+----------+----------+---------------+---------------------+
  57. 2 rows in set (0.004 sec)
  58. MySQL [oceanbase]> CREATE RESOURCE POOL poolsixlens UNIT = 'unitsixlens', UNIT_NUM = 1,ZONE_LIST = ('zone1');
  59. ERROR 4624 (HY000): machine resource 'zone1' is not enough to hold a new unit
  60. MySQL [oceanbase]> alter resource unit unitsixlens max_cpu=4 , max_memory = '2G',min_memory = '1G', max_iops = 10000, min_iops = 10000, max_session_num = 30000, max_disk_size = '4G';
  61. Query OK, 0 rows affected (0.005 sec)
  62. MySQL [oceanbase]> CREATE RESOURCE POOL poolsixlens UNIT = 'unitsixlens', UNIT_NUM = 1,ZONE_LIST = ('zone1');
  63. Query OK, 0 rows affected (0.012 sec)
  64. MySQL [oceanbase]> CREATE TENANT IF NOT EXISTS tenantsixlens charset='utf8mb4', replica_num=1, zone_list=('zone1'), primary_zone='zone1', resource_pool_list=('poolsixlens');
  65. Query OK, 0 rows affected (0.743 sec)
  66. MySQL [oceanbase]> select tenant_id,tenant_name,primary_zone from __all_tenant;
  67. +-----------+---------------+--------------+
  68. | tenant_id | tenant_name | primary_zone |
  69. +-----------+---------------+--------------+
  70. | 1 | sys | zone1 |
  71. | 1001 | tenantsixlens | zone1 |
  72. +-----------+---------------+--------------+
  73. 2 rows in set (0.004 sec)
  74. MySQL [oceanbase]> exit
  75. Bye
  76. [admin@213992b864c8 ~]$ obclient -h127.1 -uroot@tenantsixlens#obce-single -P2883 -c -A oceanbase
  77. Welcome to the OceanBase. Commands end with ; or \g.
  78. Your MySQL connection id is 7
  79. Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)
  80. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  81. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  82. MySQL [oceanbase]> CREATE USER 'usersixlens' IDENTIFIED BY '123#abc';
  83. Query OK, 0 rows affected (0.025 sec)
  84. MySQL [oceanbase]> SELECT user FROM mysql.user;
  85. +-------------+
  86. | user |
  87. +-------------+
  88. | root |
  89. | ORAAUDITOR |
  90. | usersixlens |
  91. +-------------+
  92. 3 rows in set (0.021 sec)
  93. MySQL [oceanbase]> grant all on *.* to 'usersixlens' WITH GRANT OPTION;
  94. Query OK, 0 rows affected (0.012 sec)
  95. MySQL [oceanbase]> show grants for usersixlens;
  96. +----------------------------------------------------------------+
  97. | Grants for usersixlens@% |
  98. +----------------------------------------------------------------+
  99. | GRANT ALL PRIVILEGES ON *.* TO 'usersixlens' WITH GRANT OPTION |
  100. +----------------------------------------------------------------+
  101. 1 row in set (0.018 sec)
  102. MySQL [oceanbase]> exit
  103. Bye
  104. [admin@213992b864c8 ~]$ obclient -h127.1 -uusersixlens@tenantsixlens#obce-single -P2883 -p123#abc -c -A
  105. Welcome to the OceanBase. Commands end with ; or \g.
  106. Your MySQL connection id is 8
  107. Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:52:05)
  108. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  109. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  110. MySQL [(none)]> create database testdb;
  111. Query OK, 1 row affected (0.015 sec)
  112. MySQL [(none)]> show databases;
  113. +--------------------+
  114. | Database |
  115. +--------------------+
  116. | oceanbase |
  117. | information_schema |
  118. | mysql |
  119. | test |
  120. | testdb |
  121. +--------------------+
  122. 5 rows in set (0.003 sec)
  123. MySQL [(none)]> CREATE TABLE t1 (id int,name varchar(20));
  124. ERROR 1046 (3D000): No database selected
  125. MySQL [(none)]> use testdb
  126. Database changed
  127. MySQL [testdb]> CREATE TABLE t1 (id int,name varchar(20));
  128. Query OK, 0 rows affected (0.058 sec)
  129. MySQL [testdb]> insert into t1(id,name) values(88,"cjtom");
  130. Query OK, 1 row affected (0.014 sec)
  131. MySQL [testdb]> show tables;
  132. +------------------+
  133. | Tables_in_testdb |
  134. +------------------+
  135. | t1 |
  136. +------------------+
  137. 1 row in set (0.007 sec)
  138. MySQL [testdb]>
  139. [admin@213992b864c8 ~]$ cd oceanbase-ce/
  140. [admin@213992b864c8 oceanbase-ce]$ ls
  141. admin bin etc etc2 etc3 lib log run store
  142. [admin@213992b864c8 oceanbase-ce]$ tree
  143. .
  144. |-- admin
  145. |-- bin
  146. | `-- observer -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/bin/observer
  147. |-- etc
  148. | |-- observer.config.bin
  149. | `-- observer.config.bin.history
  150. |-- etc2
  151. | |-- observer.conf.bin
  152. | `-- observer.conf.bin.history
  153. |-- etc3
  154. | |-- observer.conf.bin
  155. | `-- observer.conf.bin.history
  156. |-- lib
  157. | |-- libaio.so -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so
  158. | |-- libaio.so.1 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so.1
  159. | |-- libaio.so.1.0.1 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libaio.so.1.0.1
  160. | |-- libmariadb.so -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libmariadb.so
  161. | `-- libmariadb.so.3 -> /home/admin/.obd/repository/oceanbase-ce/3.1.1/c8d49673b8b01056ab1d6abc9d26dd6987d95a48/lib/libmariadb.so.3
  162. |-- log
  163. | |-- election.log
  164. | |-- election.log.wf
  165. | |-- observer.log
  166. | |-- observer.log.wf
  167. | |-- rootservice.log
  168. | `-- rootservice.log.wf
  169. |-- run
  170. | |-- mysql.sock
  171. | `-- observer.pid
  172. `-- store
  173. |-- clog -> /data/log1/clog
  174. |-- ilog -> /data/log1/ilog
  175. |-- slog -> /data/log1/slog
  176. `-- sstable
  177. `-- block_file
  178. 13 directories, 21 files
  179. [admin@213992b864c8 ~]$ obd cluster stop obdemo 关闭集群
  180. Get local repositories and plugins ok
  181. Open ssh connection ok
  182. Stop observer ok
  183. Stop obproxy ok
  184. obdemo stopped
  185. [admin@213992b864c8 ~]$ obd cluster display obdemo 查看
  186. Deploy "obdemo" is stopped
  187. [admin@213992b864c8 ~]$ obd cluster start obdemo -0--启动
  188. Get local repositories and plugins ok
  189. Open ssh connection ok
  190. Cluster param config check ok
  191. Check before start observer ok
  192. Check before start obproxy ok
  193. Start observer ok
  194. observer program health check ok
  195. Connect to observer ok
  196. Wait for observer init ok
  197. +---------------------------------------------+
  198. | observer |
  199. +-----------+---------+------+-------+--------+
  200. | ip | version | port | zone | status |
  201. +-----------+---------+------+-------+--------+
  202. | 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
  203. +-----------+---------+------+-------+--------+
  204. Start obproxy ok
  205. obproxy program health check x
  206. [WARN] failed to start 127.0.0.1 obproxy
  207. [ERROR] obproxy start failed
  208. [admin@213992b864c8 ~]$ obd cluster start obdemo 启动失败,重新 启动
  209. Get local repositories and plugins ok
  210. Open ssh connection ok
  211. Cluster param config check ok
  212. Check before start observer ok
  213. Check before start obproxy ok
  214. Start observer ok
  215. observer program health check ok
  216. Connect to observer ok
  217. Wait for observer init ok
  218. +---------------------------------------------+
  219. | observer |
  220. +-----------+---------+------+-------+--------+
  221. | ip | version | port | zone | status |
  222. +-----------+---------+------+-------+--------+
  223. | 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
  224. +-----------+---------+------+-------+--------+
  225. Start obproxy ok
  226. obproxy program health check ok
  227. Connect to obproxy ok
  228. Initialize cluster
  229. +---------------------------------------------+
  230. | obproxy |
  231. +-----------+------+-----------------+--------+
  232. | ip | port | prometheus_port | status |
  233. +-----------+------+-----------------+--------+
  234. | 127.0.0.1 | 2883 | 2884 | active |
  235. +-----------+------+-----------------+--------+
  236. obdemo running
  237. [admin@213992b864c8 ~]$ obd cluster display obdemo --查看ob集群运行状态
  238. Get local repositories and plugins ok
  239. Open ssh connection ok
  240. Cluster status check ok
  241. Connect to observer ok
  242. Wait for observer init ok
  243. +---------------------------------------------+
  244. | observer |
  245. +-----------+---------+------+-------+--------+
  246. | ip | version | port | zone | status |
  247. +-----------+---------+------+-------+--------+
  248. | 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
  249. +-----------+---------+------+-------+--------+
  250. Connect to obproxy ok
  251. +---------------------------------------------+
  252. | obproxy |
  253. +-----------+------+-----------------+--------+
  254. | ip | port | prometheus_port | status |
  255. +-----------+------+-----------------+--------+
  256. | 127.0.0.1 | 2883 | 2884 | active |
  257. +-----------+------+-----------------+--------+
  258. [root@localhost ~]# docker exec -it oceanbase-ce bash
  259. [admin@213992b864c8 ~]$ obd cluster display odbemo
  260. [ERROR] No such deploy: odbemo.
  261. [admin@213992b864c8 ~]$ obd cluster display obdemo
  262. Get local repositories and plugins ok
  263. Open ssh connection ok
  264. Cluster status check ok
  265. [ERROR] Some of the servers in the cluster have been stopped
  266. 127.0.0.1 oceanbase-ce is stopped
  267. 127.0.0.1 obproxy is stopped
  268. [admin@213992b864c8 ~]$ obd cluster start obdemo
  269. Get local repositories and plugins ok
  270. Open ssh connection ok
  271. Cluster param config check ok
  272. Check before start observer ok
  273. Check before start obproxy ok
  274. Start observer ok
  275. observer program health check ok
  276. Connect to observer ok
  277. Wait for observer init ok
  278. +---------------------------------------------+
  279. | observer |
  280. +-----------+---------+------+-------+--------+
  281. | ip | version | port | zone | status |
  282. +-----------+---------+------+-------+--------+
  283. | 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
  284. +-----------+---------+------+-------+--------+
  285. Start obproxy ok
  286. obproxy program health check ok
  287. Connect to obproxy ok
  288. Initialize cluster
  289. +---------------------------------------------+
  290. | obproxy |
  291. +-----------+------+-----------------+--------+
  292. | ip | port | prometheus_port | status |
  293. +-----------+------+-----------------+--------+
  294. | 127.0.0.1 | 2883 | 2884 | active |
  295. +-----------+------+-----------------+--------+
  296. obdemo running
  297. [admin@213992b864c8 ~]$ obd cluster display obdemo
  298. Get local repositories and plugins ok
  299. Open ssh connection ok
  300. Cluster status check ok
  301. Connect to observer ok
  302. Wait for observer init ok
  303. +---------------------------------------------+
  304. | observer |
  305. +-----------+---------+------+-------+--------+
  306. | ip | version | port | zone | status |
  307. +-----------+---------+------+-------+--------+
  308. | 127.0.0.1 | 3.1.1 | 2881 | zone1 | active |
  309. +-----------+---------+------+-------+--------+
  310. Connect to obproxy ok
  311. +---------------------------------------------+
  312. | obproxy |
  313. +-----------+------+-----------------+--------+
  314. | ip | port | prometheus_port | status |
  315. +-----------+------+-----------------+--------+
  316. | 127.0.0.1 | 2883 | 2884 | active |
  317. +-----------+------+-----------------+--------+