OceanBase 单机3zones集群部署详解


安装拓扑图:

环境拓扑:  
主机名       硬件配置               IP            角色             备注:
node100      8C/8G/100G       172.16.1.100   obd             OceanBase的自动化部署工具(中控机)        
node101      16C/32G/100G     172.16.1.101  observer     zone1,监听2881和2882端口
node101      16C/32G/100G     172.16.1.101  observer     zone2,监听3881和3882端口
node101      16C/32G/100G     172.16.1.101  observer     zone1,监听4881和4882端口
node100      8C/8G/100G       172.16.1.100  obproxy      监听2883和2884端口


以下操作全部都在node100上操作[中控机]:
在线安装 OBD
如您的机器可以访问公网,并能够添加三方 YUM 软件源,您可以执行以下命令,使用 OceanBase 的官方软件源安装 OBD:
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install -y ob-deploy


在所有服务器上安装 MySQL 开发包
yum install mariadb mariadb-libs mariadb-devel -y

在所有dbserver节点的,配置对应的data目录:
su - admin
mkdir -p /data/1 && mkdir -p /data/log1  && chown admin.admin /data/* -R
mkdir -p /home/admin/oceanbase-ce/2881
mkdir -p /home/admin/oceanbase-ce/3881
mkdir -p /home/admin/oceanbase-ce/4881
mkdir -p /data/obce/2881
mkdir -p /data/obce/3881
mkdir -p /data/obce/4881
mkdir -p /redo/obce/2881
mkdir -p /redo/obce/3881
mkdir -p /redo/obce/4881


编译yaml配置文件 
切换到admin用户下:
[root@node100 ~]# su - admin
 按拓扑要求,编辑文件如下:
[admin@node100 ~]$ cat oceanbase-ce-1zones.yaml
## Only need to configure when remote login is required
user:
  username: admin
  password: admin
#   key_file: your ssh-key file path if need
  port: 22
#   timeout: ssh connection timeout (second), default 30
oceanbase-ce:
  servers:
    - name: obce01
      ip: 172.16.1.101
    - name: obce02
      ip: 172.16.1.101
    - name: obce03
      ip: 172.16.1.101
  global:
    # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
    home_path: /home/admin/observer-ce
    # The directory for data storage. The default value is $home_path/store.
    data_dir: /data/1
    # The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
    redo_dir: /data/log1
    # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
    #mysql_port: 2881
    # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
    #rpc_port: 2882
    # Defines the zone for an observer. The default value is zone1.
    #zone: zone1
    # The maximum running memory for an observer. When ignored, autodeploy calculates this value based on the current server available resource.
    memory_limit: 8G
    # The percentage of the maximum available memory to the total memory. This value takes effect only when memory_limit is 0. The default value is 80.
    memory_limit_percentage: 80
    # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G. Autodeploy calculates this value based on the current server available resource.
    system_memory: 4G
    # The size of a data file. When ignored, autodeploy calculates this value based on the current server available resource.
    datafile_size: 50G
    # The percentage of the data_dir space to the total disk space. This value takes effect only when datafile_size is 0. The default value is 90.
    datafile_disk_percentage: 90
    # System log level. The default value is INFO.
    syslog_level: INFO
    # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true. The default value for autodeploy mode is false.
    enable_syslog_wf: true
    # Enable auto system log recycling or not. The default value is false. The default value for autodeploy mode is on.
    enable_syslog_recycle: true
    # The maximum number of reserved log files before enabling auto recycling. When set to 0, no logs are deleted. The default value for autodeploy mode is 4.
    max_syslog_file_count: 4
    # Cluster name for OceanBase Database. The default value is obcluster. When you deploy OceanBase Database and obproxy, this value must be the same as the cluster_name for obproxy.
    appname: oceanbase-ce
    # Password for root. The default value is empty.
    root_password: 123456
    # Password for proxyro. proxyro_password must be the same as observer_sys_password. The default value is empty.
    proxyro_password: 123456
  obce01:
    mysql_port: 2881
    rpc_port: 2882
    home_path: /home/admin/oceanbase-ce/2881
    data_dir: /data/obce/2881
    redo_dir: /redo/obce/2881
    zone: zone1
  obce02:
    mysql_port: 3881
    rpc_port: 3882
    home_path: /home/admin/oceanbase-ce/3881
    data_dir: /data/obce/3881
    redo_dir: /redo/obce/3881
    zone: zone2
  obce03:
    mysql_port: 4881
    rpc_port: 4882
    home_path: /home/admin/oceanbase-ce/4881
    data_dir: /data/obce/4881
    redo_dir: /redo/obce/4881
    zone: zone3
obproxy:
  depends:
    - oceanbase-ce
  servers:
    - 172.16.1.100
  global:
    # The working directory for obproxy. Obproxy is started under this directory. This is a required field.
    home_path: /home/admin/obproxy
    # External port. The default value is 2883.
    listen_port: 2883
    # The Prometheus port. The default value is 2884.
    # prometheus_listen_port: 2884
    # rs_list is the root server list for observers. The default root server is the first server in the zone.
    # The format for rs_list is observer_ip:observer_mysql_port;observer_ip:observer_mysql_port.
    # Ignore this value in autodeploy mode.
    # rs_list: 127.0.0.1:2881
    # Cluster name for the proxy OceanBase Database. The default value is obcluster. This value must be set to the same with the appname for OceanBase Database.
    cluster_name: oceanbase-ce
    # Password for obproxy system tenant. The default value is empty.
    obproxy_sys_password: 123456
    # Password for proxyro. proxyro_password must be the same with proxyro_password. The default value is empty.
    observer_sys_password: 123456

在node100节点上,通过obd进行全自动安装:
su - admin
[admin@node100 ~]$ obd cluster deploy oceanbase-ce -c oceanbase-ce-3zones.yaml
oceanbase-ce-3.1.1 already installed.
obproxy-3.2.0 already installed.
+-----------------------------------------------------------------------------+
|                                  Packages                                  |
+--------------+---------+---------+------------------------------------------+
| Repository  | Version | Release | Md5                                      |
+--------------+---------+---------+------------------------------------------+
| oceanbase-ce | 3.1.1  | 4.el7  | f19f8bfb67723712175fb0dfd60579196b3168f1 |
| obproxy      | 3.2.0  | 1.el7  | 8d5c6978f988935dc3da1dbec208914668dcf3b2 |
+--------------+---------+---------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository install ok
Remote oceanbase-ce-3.1.1-f19f8bfb67723712175fb0dfd60579196b3168f1 repository lib check ok
Remote obproxy-3.2.0-8d5c6978f988935dc3da1dbec208914668dcf3b2 repository install ok
Remote obproxy-3.2.0-8d5c6978f988935dc3da1dbec208914668dcf3b2 repository lib check ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
oceanbase-ce deployed


su - admin
查看集群的名称:
[admin@node100 ~]$ obd cluster list
+------------------------------------------------------------------------+
|                              Cluster List                              |
+--------------+---------------------------------------+-----------------+
| Name         | Configuration Path                    | Status (Cached) |
+--------------+---------------------------------------+-----------------+
| oceanbase-ce | /home/admin/.obd/cluster/oceanbase-ce | stopped         |
+--------------+---------------------------------------+-----------------+
启动集群:
[admin@node100 ~]$ obd cluster start oceanbase-ce
[admin@node100 ~]$ obd cluster start oceanbase-ce
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap ok
Wait for observer init ok
+------------------------------------------------+
|                    observer                    |
+--------------+---------+------+-------+--------+
| ip          | version | port | zone  | status |
+--------------+---------+------+-------+--------+
| 172.16.1.101 | 3.1.1  | 2881 | zone1 | active |
| 172.16.1.101 | 3.1.1  | 3881 | zone2 | active |
| 172.16.1.101 | 3.1.1  | 4881 | zone3 | active |
+--------------+---------+------+-------+--------+


Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster
+------------------------------------------------+
|                    obproxy                    |
+--------------+------+-----------------+--------+
| ip          | port | prometheus_port | status |
+--------------+------+-----------------+--------+
| 172.16.1.100 | 2883 | 2884            | active |
+--------------+------+-----------------+--------+
oceanbase-ce running
[admin@node100 ~]$


停止集群:
[admin@node100 ~]$ obd cluster stop oceanbase-ce
Get local repositories and plugins ok
Open ssh connection ok
Stop observer ok
Stop obproxy ok
oceanbase-ce stopped
[admin@node100 ~]$ 


删除集群:
[admin@node100 ~]$ obd cluster destroy  oceanbase-ce
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
observer work dir cleaning ok
obproxy work dir cleaning ok
oceanbase-ce destroyed




登录集群:
[admin@node100 ~]$ mysql -h172.16.1.100 -uroot@sys#oceanbase-ce -P2883 -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25 OceanBase 3.1.1 (r4-8c615943cbd25a6f7b8bdfd8677a13a21709a05e) (Built Oct 21 2021 10:33:14)
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 [SYS]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.01 sec)


分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS