• OceanBase 4.0 三节点生产环境部署两三事


    相信有很多朋友之前已经部署过 OceanBase 3.1.4 或者更早的版本了,当然也有朋友说之前的版本有点吃资源,自己的环境真的达不到要求,所以 “以前安装都装不上,所有的能力只停留在他们自己口述上” 。

    今天发布了 OB 4.0 版本,对资源把控上更好一些,大家应该不会仅仅停留在单机尝鲜

    下面我们来看一下如何在现有服务器上进行 3 节点的更新。

    1. all-in-one 安装

    其实这个 all-in-one 安装包主要是方便,所以我这里又要推荐大家一下了,在 1 台服务器上安装这个 all-in-one 的包(找不到包的可以看我 单机尝鲜 找一下链接),这一步我们主要就是两点:

    • 更新 obd
    • 解压缩找到 rpm

    2. 复用 3.1.4 配置文件初始化集群

    obd 更新完后,obd --help 获取的版本信息为 v1.6.0,11月2日发布的。此时我们拿出之前部署 3.1.4 版本的 yaml 配置文件即可。

    注意:如果想替换的顺滑的话,可以使用 obd cluster destroy 把之前的集群销毁掉,否则还需要改集群名字。

    我的配置文件大概长这样:

    ## Only need to configure when remote login is required
    # user:
    #   username: your username
    #   password: your password if need
    #   key_file: your ssh-key file path if need
    #   port: your ssh port, default 22
    #   timeout: ssh connection timeout (second), default 30
    oceanbase-ce:
      servers:
        - name: server1
          # Please don't use hostname, only IP can be supported
          ip: 192.168.10.123
        - name: server2
          ip: 192.168.10.124
        - name: server3
          ip: 192.168.10.128
      global:
        # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
        home_path: /home/admin/observer
        # The directory for data storage. The default value is $home_path/store.
        data_dir: /data/OceanBase/data
        # The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
        redo_dir: /data/OceanBase/redo
        # 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's name is "eth0", please use "eth0"
        devname: eth0
        # 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: 58G
        # 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: 22G
        # The size of a data file. When ignored, autodeploy calculates this value based on the current server available resource.
        datafile_size: 1024G
        # 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: false
        # 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: obcluster
        # Password for root. The default value is empty.
        root_password: oceanbase
        # Password for proxyro. proxyro_password must be the same as observer_sys_password. The default value is empty.
        proxyro_password: oceanbase
      server1:
        zone: zone1
      server2:
        zone: zone2
      server3:
        zone: zone3
    obproxy-ce:
      depends:
        - oceanbase-ce
      servers:
        - 192.168.10.123
        - 192.168.10.124
        - 192.168.10.128
      global:
        # The working directory for obproxy. Obproxy is started under this directory. This is a required field.
        home_path: /home/admin/obproxy
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
        # 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: obcluster
        # Password for obproxy system tenant. The default value is empty.
        obproxy_sys_password: oceanbase
        # Password for proxyro. proxyro_password must be the same with proxyro_password. The default value is empty.
        observer_sys_password: oceanbase
    
    • 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

    此时我们直接跟以前一样,执行 autodeploy 命令即可:

    [admin@gpdbs01 ~]$ obd cluster destroy obcluster
    Get local repositories ok
    Search plugins ok
    Open ssh connection ok
    Cluster status check ok
    observer work dir cleaning ok
    obproxy work dir cleaning ok
    obcluster destroyed
    [admin@gpdbs01 ~]$ obd cluster autodeploy obcluster -c cluster.yaml
    Found a higher version
    name: oceanbase-ce
    version: 4.0.0.0
    release:100000272022110114.el7
    arch: x86_64
    md5: 42611dc51ca9bb28f36e60e4406ceea4a74914c7
    Do you want to use it? [y/n]: y
    Package oceanbase-ce-4.0.0.0-100000272022110114.el7 is available.
    Found a higher version
    name: obproxy-ce
    version: 4.0.0
    release:5.el7
    arch: x86_64
    md5: de53232a951184fad75b15884458d85e31d2f6c3
    Do you want to use it? [y/n]: y
    Package obproxy-ce-4.0.0-5.el7 is available.
    install oceanbase-ce-4.0.0.0 for local ok
    install obproxy-ce-4.0.0 for local ok
    Cluster param config check ok
    Open ssh connection ok
    Generate observer configuration ok
    Generate obproxy configuration ok
    install oceanbase-ce-4.0.0.0 for local ok
    install obproxy-ce-4.0.0 for local ok
    +--------------------------------------------------------------------------------------------+
    |                                          Packages                                          |
    +--------------+---------+------------------------+------------------------------------------+
    | Repository   | Version | Release                | Md5                                      |
    +--------------+---------+------------------------+------------------------------------------+
    | oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 |
    | obproxy-ce   | 4.0.0   | 5.el7                  | de53232a951184fad75b15884458d85e31d2f6c3 |
    +--------------+---------+------------------------+------------------------------------------+
    Repository integrity check ok
    Parameter check ok
    Open ssh connection ok
    Cluster status check ok
    Initializes observer work home ok
    Initializes obproxy work home ok
    Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository install ok
    Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository lib check !!
    Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
    Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
    Try to get lib-repository
    Found a higher version
    name: oceanbase-ce-libs
    version: 4.0.0.0
    release:100000272022110114.el7
    arch: x86_64
    md5: 188919f8128394bf9b62e3989220ded05f1d14da
    Do you want to use it? [y/n]: y
    Package oceanbase-ce-libs-4.0.0.0-100000272022110114.el7 is available.
    install oceanbase-ce-libs-4.0.0.0 for local ok
    Remote oceanbase-ce-libs-4.0.0.0-100000272022110114.el7-188919f8128394bf9b62e3989220ded05f1d14da repository install ok
    Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository lib check ok
    obcluster deployed
    Get local repositories ok
    Search plugins ok
    Open ssh connection ok
    Load cluster param plugin ok
    Check before start observer ok
    [WARN] (192.168.10.123) clog and data use the same disk (/data)
    [WARN] (192.168.10.124) clog and data use the same disk (/data)
    [WARN] (192.168.10.128) clog and data use the same disk (/data)
    
    Check before start obproxy ok
    Start observer ok
    observer program health check ok
    Connect to observer ok
    Initialize cluster ok
    Start obproxy ok
    obproxy program health check ok
    Connect to obproxy ok
    Initialize cluster ok
    Wait for observer init ok
    +-------------------------------------------------+
    |                     observer                    |
    +---------------+---------+------+-------+--------+
    | ip            | version | port | zone  | status |
    +---------------+---------+------+-------+--------+
    | 192.168.10.123 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
    | 192.168.10.124 | 4.0.0.0 | 2881 | zone2 | ACTIVE |
    | 192.168.10.128 | 4.0.0.0 | 2881 | zone3 | ACTIVE |
    +---------------+---------+------+-------+--------+
    obclient -h192.168.10.123 -P2881 -uroot -poceanbase -Doceanbase
    
    +-------------------------------------------------+
    |                     obproxy                     |
    +---------------+------+-----------------+--------+
    | ip            | port | prometheus_port | status |
    +---------------+------+-----------------+--------+
    | 192.168.10.123 | 2883 | 2884            | active |
    | 192.168.10.124 | 2883 | 2884            | active |
    | 192.168.10.128 | 2883 | 2884            | active |
    +---------------+------+-----------------+--------+
    obclient -h192.168.10.123 -P2883 -uroot -poceanbase -Doceanbase
    obcluster running
    
    • 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

    3. 总结

    整体看下来是不是还挺简单,基本上比较平滑的做到了软件的替换,但是总结下来有几点需要注意:

    • 本文内容是新建集群,升级软件,不涉及数据迁移,理论上讲,3.1.4 到 4.0 的数据迁移不能通过升级软件来完成,可能需要花时间做数据导出导入或其他方式;
    • 从第2章内容也可以看到,整个部署过程中,是在线方式的,一直在询问是否使用发现的最新版本,这一点我还没测,按照以往的逻辑,如果是离线环境,只需要把 repo 改为本地镜像并把 rpm 导入本地即可完成(有待后面测试)
    • autodeploy 方式属于取巧的方式,obd 会自动计算一些资源参数,比如内存大小,如果对 OB 掌握的较好,还是自己指定一些系统参数更为妥当。

    End~

  • 相关阅读:
    C#实现二叉树的最大深度
    【Spring从入门到实战】第 3 讲:Spring中Bean的注入方式
    基础gdb操作【Linux】
    webview_flutter
    python数据容器——元组、字符串
    vr虚拟仿真样板间极大节省出样成本-深圳华锐视点
    Mybatis(四)
    vue3.2 封装一个 可编辑的table插件
    【python入门篇】列表简介及操作(2)
    Spring Boot整合 Cache 以Redis服务 处理数据缓存
  • 原文地址:https://blog.csdn.net/chrisy521/article/details/127660668