首页 > 其他分享 >手动部署OceanBase集群

手动部署OceanBase集群

时间:2023-04-25 10:34:39浏览次数:41  
标签:2882 2881 observer cluster OceanBase 手动 192.168 admin 集群

 

1. 准备工作

准备工作参考:https://www.cnblogs.com/haha029/p/17336622.html 中的“准备工作”

初始化基础环境:创建admin用户、配置ssh互信、修改内核、修改会话变量、配置防火墙、配置时钟同步。

2. 部署OceanBase集群

2.1 安装oceanbase-ce软件包

[admin]# sudo rpm -ivh oceanbase-ce-*.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:oceanbase-ce-libs-4.0.0.0-1000002################################# [ 50%]
   2:oceanbase-ce-4.0.0.0-100000272022################################# [100%]
[admin]# sudo chown -R admin:admin /home/admin/oceanbase

2.2 创建相应的目录

提示:生产环境要求data和redo目录是两个独立的物理磁盘,或者最低要求是两个独立的逻辑盘。

[admin]# mkdir -p /data/observer/store/ob_cluster/{clog,ilog,slog,etc2}
[admin]# mkdir -p /data/observer/store/ob_cluster/{sstable,etc3}

 2.3 启动observer进程

192.168.1.71端:

[admin]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib" >> .bashrc
[admin]# source .bashrc
[admin]# cd /home/admin/oceanbase && bin/observer -i ens33 -p 2881 -P 2882 -z zone1 -d /data/observer/store/ob_cluster -r '192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881' -c 1 -n ob_cluster -o "memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2"

192.168.1.72端:

[admin]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib" >> .bashrc
[admin]# source .bashrc
[admin]# cd /home/admin/oceanbase && bin/observer -i ens33 -p 2881 -P 2882 -z zone2 -d /data/observer/store/ob_cluster -r '192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881' -c 1 -n ob_cluster -o "memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2"

192.168.1.73端:

[admin]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/oceanbase/lib" >> .bashrc
[admin]# source .bashrc
[admin]# cd /home/admin/oceanbase && bin/observer -i ens33 -p 2881 -P 2882 -z zone3 -d /data/observer/store/ob_cluster -r '192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881' -c 1 -n ob_cluster -o "memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2"

 2.4 检查observer服务以及相关端口

sql_port: 2881

rpc_port: 2882

 

192.168.1.71端:

[admin]# ps -ef | grep observer | grep -v grep
admin    34022     1 99 Apr24 ?        1-04:09:15 bin/observer -i ens33 -p 2881 -P 2882 -z zone1 -d /data/observer/store/ob_cluster -r 192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881 -c 1 -n ob_cluster -o memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2
[admin]# ss -ant | egrep "2881|2882" | grep LISTEN
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2882                     *:*

192.168.1.72端:

[admin]# ps -ef | grep observer | grep -v grep
admin    34022     1 99 Apr24 ?        1-04:09:15 bin/observer -i ens33 -p 2881 -P 2882 -z zone2 -d /data/observer/store/ob_cluster -r 192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881 -c 1 -n ob_cluster -o memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2
[admin]# ss -ant | egrep "2881|2882" | grep LISTEN
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2882                     *:*

192.168.1.73端:

[admin]# ps -ef | grep observer | grep -v grep
admin    34022     1 99 Apr24 ?        1-04:09:15 bin/observer -i ens33 -p 2881 -P 2882 -z zone3 -d /data/observer/store/ob_cluster -r 192.168.1.71:2882:2881;192.168.1.72:2882:2881;192.168.1.73:2882:2881 -c 1 -n ob_cluster -o memory_limit=6G,cache_wash_threshold=1G,system_memory=1G,memory_chunk_cache_size=128M,cpu_count=4,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/observer/store/ob_cluster/etc3;/data/observer/store/ob_cluster/etc2
[admin]# ss -ant | egrep "2881|2882" | grep LISTEN
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2881                     *:*                  
LISTEN     0      1024         *:2882                     *:*

 2.5 OceanBase集群初始化

连接任意一节点(默认无密码)

[admin]# obclient -h127.0.0.1 -P2881 -uroot@sys -p -A

obclient [(none)]> set session ob_query_timeout=1000000000;
Query OK, 0 rows affected (0.014 sec)

obclient [(none)]> alter system bootstrap ZONE 'zone1' SERVER '192.168.1.71:2882', ZONE 'zone2' SERVER '192.168.1.72:2882', ZONE 'zone3' SERVER '192.168.1.73:2882';
Query OK, 0 rows affected (1 min 18.640 sec)

 2.6 查看OceanBase集群节点信息

obclient [oceanbase]> select zone,id,svr_ip,svr_port,inner_port,status,start_service_time,stop_time from __all_server;
+-------+----+--------------+----------+------------+--------+--------------------+-----------+
| zone  | id | svr_ip       | svr_port | inner_port | status | start_service_time | stop_time |
+-------+----+--------------+----------+------------+--------+--------------------+-----------+
| zone1 |  1 | 192.168.1.71 |     2882 |       2881 | ACTIVE |   1682332392218402 |         0 |
| zone2 |  2 | 192.168.1.72 |     2882 |       2881 | ACTIVE |   1682332393197284 |         0 |
| zone3 |  3 | 192.168.1.73 |     2882 |       2881 | ACTIVE |   1682332396105272 |         0 |
+-------+----+--------------+----------+------------+--------+--------------------+-----------+

 2.7 修改密码

使用root@sys用户连接

[admin]# obclient -h127.0.0.1 -P2881 -D oceanbase -uroot@sys -p -A

 修改root用户密码

obclient [oceanbase]> alter user root identified by 'OceanBase010';

创建proxyro用户,obproxy连接oceanbase时使用

obclient [oceanbase]> grant select on oceanbase.* to proxyro identified by 'OceanBase010';

 3 安装obproxy

 3.1 安装obproxy软件包

[admin]# sudo rpm -ivh obproxy-ce-4.0.0-5.el7.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:obproxy-ce-4.0.0-5.el7           ################################# [100%]

 3.2 启动obproxy服务

[admin]# cd /home/admin/obproxy-4.0.0 && bin/obproxy -r "192.168.1.71:2881;192.168.1.72:2881;192.168.1.73:2881" -p 2883 -o "enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false" -c ob_cluster
bin/obproxy -r 192.168.1.71:2881;192.168.1.72:2881;192.168.1.73:2881 -p 2883 -o enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false -c ob_cluster
rs list: 192.168.1.71:2881;192.168.1.72:2881;192.168.1.73:2881
listen port: 2883
optstr: enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false
cluster_name: ob_cluster

3.3 修改proxy密码

用户名:root@proxysys,端口:2883,初始密码:空

[admin]# mysql -h 192.168.1.71 -P2883 -u root@proxysys -p
mysql> show proxyconfig like '%sys_password%';
+------------------------+-------+--------------------------------+-------------+---------------+
| name                   | value | info                           | need_reboot | visible_level |
+------------------------+-------+--------------------------------+-------------+---------------+
| observer_sys_password1 |       | password for observer sys user | false       | SYS           |
| observer_sys_password  |       | password for observer sys user | false       | SYS           |
| obproxy_sys_password   |       | password for obproxy sys user  | false       | SYS           |
+------------------------+-------+--------------------------------+-------------+---------------+
mysql> alter proxyconfig set obproxy_sys_password='OceanBase010';
Query OK, 0 rows affected (0.05 sec)

mysql> alter proxyconfig set observer_sys_password='OceanBase010';
Query OK, 0 rows affected (0.05 sec)

3.4 通过obproxy连接oceanbase集群

[admin]# mysql -h192.168.1.71 -P2883 -D oceanbase -uroot@sys#ob_cluster -p -A
mysql> show processlist;
+------------+---------+--------------------+-----------+---------+------+--------+------------------+
| Id         | User    | Host               | db        | Command | Time | State  | Info             |
+------------+---------+--------------------+-----------+---------+------+--------+------------------+
| 3221752263 | root    | 192.168.1.71:44346 | oceanbase | Query   |    0 | ACTIVE | show processlist |
| 3221487776 | proxyro | 192.168.1.71:53746 | oceanbase | Sleep   |    5 | SLEEP  | NULL             |
+------------+---------+--------------------+-----------+---------+------+--------+------------------+

mysql> show full processlist;
+------------+---------+--------+--------------------+-----------+---------+------+--------+-----------------------+--------------+------+----------------------+
| Id         | User    | Tenant | Host               | db        | Command | Time | State  | Info                  | Ip           | Port | Proxy_sessid         |
+------------+---------+--------+--------------------+-----------+---------+------+--------+-----------------------+--------------+------+----------------------+
| 3221752263 | root    | sys    | 192.168.1.71:44346 | oceanbase | Query   |    0 | ACTIVE | show full processlist | 192.168.1.72 | 2881 |                 NULL |
| 3221890762 | proxyro | sys    | 192.168.1.71:45410 | oceanbase | Sleep   |    1 | SLEEP  | NULL                  | 192.168.1.72 | 2881 | 13882347256012800205 |
| 3221890799 | NULL    |        | 192.168.1.73:2882  | oceanbase | Sleep   |    0 | INIT   | NULL                  | 192.168.1.72 | 2881 |                    1 |
+------------+---------+--------+--------------------+-----------+---------+------+--------+-----------------------+--------------+------+----------------------+

 

标签:2882,2881,observer,cluster,OceanBase,手动,192.168,admin,集群
From: https://www.cnblogs.com/haha029/p/17351875.html

相关文章

  • K8s 集群 etcd节点故障解决方案
    1环境说明k8s版本:v1.20etcd节点(192.168.0.12)故障: 报错详情: 4月2422:47:13k8s-node2etcd[9543]:{"level":"warn","ts":"2023-04-24T22:47:13.571+0800","caller":"etcdserver/server.go:2065","msg":......
  • 集群时钟同步必读-NTP和chrony
     一、 前言搭建和维护集群环境中时钟同步是非常重要一环。如果集群的时间不统一,例如ceph集群就会报错无法更新数据、CDH集群无法添加客户端等等。目前主流在Linux系统搭建集群用到NTP和chrony软件,本文简单介绍两者的集群搭建。二、 NTP和chrony区别根据chrony官......
  • kubectl 命令 --save-config 将部署信息添加到注解,防止deploy或webhook通过注释添加
    1、--save-config为什么需要使用kubctlapply保存配置?kubectl apply<file.yaml>--save-config创建或更新部署,并将部署另存为元数据。文件上说--save-config[=false]:如果为true,则当前对象的配置将保存在其注释中。当您将来要对此对象执行kubectlapply时,这非常有用。为什么......
  • JS高级之手动实现new操作符
    相信大家都很好奇,在js中为什么函数在经过new操作之后会变成一个对象?functionFoot(params){this.name=params}Foot("aa")undefinednewFoot("aa")Foot {name:'aa'}实际上,new是一个语法糖从上面介绍中,我们可以看到new关键字主要做了以下的工作:创建一个新的对......
  • kubernetes集群的高可用架构
    概述kubernete在云平台的高可用分为两种情形单az的高可用集群搭建多az的高可用集群搭建这两种情形其实就是一个k8s集群内部的高可用,只是多az的场景下能够实现更高级别的高可用,此时k8s需要跨az部署集群。集群内部的高可用需要实现基础组件的高可用,其中最重要的就是etcd和api......
  • 手动恢复_MariaDB_集群
    KEYWORDS:tencent,tstack,solution,HISTORY:Createdat15:26:22on2020-02-15.手动恢复MariaDB集群(TStackK与P版均适用)(2020-02-15)[ERROR]WSREP:bind:Addressalreadyinuse[ERROR]WSREP:failedtoopenglombackendconnection:98:errorwhile......
  • 手动拷贝文件至nextcloud中并扫描(docker)
    出于不能在nextcloud的web页面手动上传,需要写脚本实现自动上传文件至nextcloud的目的,直接在服务器上将文件手动拷贝到nextcloud目录:dockercp/data/filesnextcloud:/var/www/html/data/账号名/files但是一般人不这么做,一般挂载到-v卷岂不更好在nextcloud目录中我们可以这么扫......
  • java调用GDAL,接口运行一次出现A fatal error has been detected by the Java Runtime
    参考文章:https://www.jianshu.com/p/4bffe29e3a02问题描述:通过调用GDAL写的SpringBoot接口,第一次访问成功,第二次报错,显示报错的位置为gdal库。尝试了很多方法https://www.cnblogs.com/jokingremarks/p/15132599.html#!comments仍然不成功,感觉应该是第二次运行接口时,进行垃圾回......
  • redis应用场景及三种集群方式
    1.正文1.redis应用场景2.redis得持久化方式3.redis得集群4.java连接redis服务器2.redis应用场景1、热点数据的缓存----由于redis访问速度块、支持的数据类型比较丰富,所以redis很适合用来存储热点数据,另外结合expire,我们可以设置过期时间然后再进行缓存更新操作,这......
  • 以太网链路聚合与交换机堆叠、集群
    随着业务的发展和园区网络规模的不断扩大,用户对于网络的带宽、可靠性要求越来越高。对于这种情况,传统解决方案通过升级设备方式提高网络带宽,同时通过部署冗余链路并辅以STP协议实现高可靠,然而这种方案存在灵活度低、故障恢复时间长、配置复杂、成本高等缺点。为了解决这些问题,我们......