首页 > 其他分享 >多节点oceanbase 集群部署

多节点oceanbase 集群部署

时间:2024-03-09 16:34:14浏览次数:25  
标签:12 oceanbase obclient 2024 集群 ipv4 net 节点

安装前准备

硬件要求

CPU最少2核
磁盘最少19G
文件系统EXT4 戓 XFS

关闭透明大页

echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled

确认操作系统版本是否支持

[root@innodb-cluster01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)

清除缓存

echo 3 > /proc/sys/vm/drop_caches

设置ssh互信(执行下面的脚本)

#!/usr/bin/bash
   
SERVERS=("root@innodb-cluster01" "root@innodb-cluster02" "root@innodb-cluster03")	#修改为自己的"用户名@主机名/ip"
PASSWORD="******"	#输入用户的密码
keygen() {
sudo yum -y install expect
expect -c "
   spawn ssh-keygen -t rsa
   expect {
      *(~/.ssh/id_rsa):* { send -- \r;exp_continue}
      *(y/n)* { send -- y\r;exp_continue}
      *Enter* { send -- \r;exp_continue}
      *(y/n)* { send -- y\r;exp_continue}
      *Enter* { send -- \r;exp_continue}
      eof {exit 0}
   }
   expect eof
"
}
copy(){
expect -c "
   set timeout -1
   spawn ssh-copy-id $1
   expect {
      *(yes/no)* { send -- yes\r; exp_continue }
      *password:* { send -- $PASSWORD\r; exp_continue}
      eof {exit 0}
   }
   expect eof
"
}
ssh_copy_id_to_all(){
keygen ;
for host in ${SERVERS[@]}
do
      copy $host
done
}
ssh_copy_id_to_all

配置ntp

配置ulimit.conf

#vi /etc/sysctl.conf

# for oceanbase
## 修改内核异步 I/O 限制
fs.aio-max-nr=1048576

## 网络优化
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 10000 
net.core.rmem_default = 16777216 
net.core.wmem_default = 16777216 
net.core.rmem_max = 16777216 
net.core.wmem_max = 16777216

net.ipv4.ip_local_port_range = 3500 65535 
net.ipv4.ip_forward = 0 
net.ipv4.conf.default.rp_filter = 1 
net.ipv4.conf.default.accept_source_route = 0 
net.ipv4.tcp_syncookies = 1 
net.ipv4.tcp_rmem = 4096 87380 16777216 
net.ipv4.tcp_wmem = 4096 65536 16777216 
net.ipv4.tcp_max_syn_backlog = 16384 
net.ipv4.tcp_fin_timeout = 15 
net.ipv4.tcp_max_syn_backlog = 16384 
net.ipv4.tcp_tw_reuse = 1 
net.ipv4.tcp_tw_recycle = 1 
net.ipv4.tcp_slow_start_after_idle=0

vm.swappiness = 0
vm.min_free_kbytes = 2097152
fs.file-max = 6573688

# 修改进程可以拥有的虚拟内存区域数量
vm.max_map_count = 655360

# 此处为 OceanBase 数据库的 data 目录
kernel.core_pattern = /data/ob/core-%e-%p-%t

#sysctl -p

规划磁盘

mkdir -p /data/ob/{data,redo,oceanbase}
data 	#数据盘
redo	#事务日志盘
oceanbase	#数据库安装盘

部署阶段

离线部署all-in-one

tar -xzf oceanbase-all-in-one-4.2.2.0-100010012024022719.el7.x86_64.tar.gz
cd oceanbase-all-in-one/bin
./install.sh
source ~/.oceanbase-all-in-one/bin/env.sh

使用OBD网页部署

obd web
start OBD WEB in 0.0.0.0:8680
please open http://192.168.56.20:8680

打开网页

选择OceanBase及配套工具

image

配置集群名称,选择需要部署的组件.

image

配置Zone信息、组件节点信息、部署用户信息、软件目录信息.

image

配置数据库信息,安装目录和端口信息.

image

安装前检查

image

安装完成

OCP Express安装失败,不影响数据库使用.
image

安装后的操作

根据安装页面上的信息登录数据库

[root@innodb-cluster01 ob]# obclient -h192.168.56.20 -P2883 -uroot -p'YW7cqUk{HO-9-Z' -Doceanbase -A
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 1049236
Server version: OceanBase_CE 4.2.2.0 (r100010012024022719-c984fe7cb7a4cef85a40323a0d073f0c9b7b8235) (Built Feb 27 2024 19:20:54)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [oceanbase]> 

资源配置

查看已有的资源规格

USE oceanbase;
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS;
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
| UNIT_CONFIG_ID | NAME            | CREATE_TIME                | MODIFY_TIME                | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS            | MIN_IOPS            | IOPS_WEIGHT |
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
|              1 | sys_unit_config | 2024-03-09 12:26:54.055433 | 2024-03-09 12:26:54.055433 |       3 |       3 |  1073741824 |    2147483648 | 9223372036854775807 | 9223372036854775807 |           3 |
|           1001 | ocp_unit        | 2024-03-09 12:28:51.502812 | 2024-03-09 12:28:51.502812 |       1 |       1 |  2147483648 |    6442450944 | 9223372036854775807 | 9223372036854775807 |           1 |
+----------------+-----------------+----------------------------+----------------------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
2 rows in set (0.001 sec)

创建资源规格

CREATE RESOURCE UNIT S1_unit_config
                MEMORY_SIZE = '3G',
                MAX_CPU = 1, MIN_CPU = 1,
                LOG_DISK_SIZE = '2G',
                MAX_IOPS = 10000, MIN_IOPS = 10000, IOPS_WEIGHT=1;

资源池配置

查看资源池信息

USE oceanbase;
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_RESOURCE_POOLS;
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME     | TENANT_ID | CREATE_TIME                | MODIFY_TIME                | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
|                1 | sys_pool |         1 | 2024-03-09 12:26:54.064822 | 2024-03-09 12:26:54.085847 |          1 |              1 | zone1     | FULL         |
|             1001 | ocp_pool |      NULL | 2024-03-09 12:28:51.534729 | 2024-03-09 12:29:32.778672 |          3 |           1001 | zone1     | FULL         |
+------------------+----------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
2 rows in set (0.007 sec)

创建资源池

CREATE RESOURCE POOL mq_pool_01 
 UNIT='S1_unit_config', 
 UNIT_NUM=1; 

租户配置

查看租户信息

obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TENANTS;
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN | REPLAYABLE_SCN | READABLE_SCN | RECOVERY_UNTIL_SCN | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
|         1 | sys         | SYS         | 2024-03-09 12:26:54.115187 | 2024-03-09 12:26:54.115187 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |     NULL |           NULL |         NULL |               NULL | NOARCHIVELOG | DISABLED                   |        1 | 4.2.2.0    |         1 |
+-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+----------+----------------+--------------+--------------------+--------------+----------------------------+----------+------------+-----------+
1 row in set (0.073 sec)

创建租户

obclient [oceanbase]> CREATE TENANT IF NOT EXISTS mq_t1 
    ->  PRIMARY_ZONE='zone1', 
    ->  RESOURCE_POOL_LIST=('mq_pool_01')
    ->  set OB_TCP_INVITED_NODES='%';
Query OK, 0 rows affected (1 min 5.974 sec)

使用新租户进入数据库

[root@innodb-cluster01 security]# obclient -P2883 -h192.168.56.20 -uroot@mq_t1 -A
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 4
Server version: OceanBase_CE 4.2.2.0 (r100010012024022719-c984fe7cb7a4cef85a40323a0d073f0c9b7b8235) (Built Feb 27 2024 19:20:54)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| oceanbase          |
| test               |
+--------------------+
4 rows in set (0.005 sec)

创建数据库

obclient [(none)]> create database db1;
Query OK, 1 row affected (0.115 sec)

创建表

obclient [db1]>  create table t1(co1 int,co2 int);
Query OK, 0 rows affected (0.466 sec)

参考文档:

https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000510451

总结

  • 安装过程中OCP报错,目前没有找到原因,OCP是使用网页管理数据库的工具,暂时不影响命令行使用数据库.

标签:12,oceanbase,obclient,2024,集群,ipv4,net,节点
From: https://www.cnblogs.com/idealx/p/18062862

相关文章

  • 代码随想录 第十六天 | ● 104.二叉树的最大深度 559.n叉树的最大深度 ● 111.二叉树
    leetcode:104.二叉树的最大深度-力扣(LeetCode)思路:递归判断每次左右节点的是否存在,存在自然加一,return的1就是这样,判断子节点的左右两端是否有节点,统计有的节点数量,也就是左右的高度classSolution{publicintmaxDepth(TreeNoderoot){//后序遍历if......
  • 代码随想录算法训练营第四天| 24. 两两交换链表中的节点 19.删除链表的倒数第N个节点
    24.两两交换链表中的节点https://leetcode.cn/problems/swap-nodes-in-pairs/description/publicListNodeswapPairs(ListNodehead){if(head==null||head.next==null)returnhead;ListNoderes=head.next;ListNodepre=newListNod......
  • Docker搭建Mysql集群
    一、新建主服务器示例3307dockerrun-p3307:3306--namemysql-master\-v/docker-volume/mysql-master/log:/var/log/mysql\-v/docker-volume/mysql-master/data:/var/lib/mysql\-v/docker-volume/mysql-master/conf:/etc/mysql\-eMYSQL_ROOT_PASSWORD=root\-d......
  • MongoDB 7.0集群部署
    环境描述:OS:openEuler22.03LTS-SP3mongoDB:7.0.6mongodb-database-tools:100.9.0mongosh:2.1.5GCC:12.3.1Python:3.9.9Clang:12.0.1服务器规划:主机名IP地址MongosServer组件端口ConfigServer组件端口ShardServer组件端口mongo-01192.168.83.102701727018主节......
  • Docker搭建Redis集群
    一、创建Redis网络dockernetworklsdockernetworkcreateredis--subnet192.168.100.0/24dockernetworkinspectredis二、创建Redis配置文件forportin$(seq16);\do\mkdir-p/docker-volume/redis-cluster/node-${port}/conftouch/docker-volume/redis-c......
  • 450. 删除二叉搜索树中的节点c
    这题特别好,和递归删除链表里的元素有异曲同工之妙/***Definitionforabinarytreenode.*structTreeNode{*intval;*structTreeNode*left;*structTreeNode*right;*};*/structTreeNode*leftleave(structTreeNode*root){root=r......
  • k8s集群安装nfs持久化存储
    k8s集群安装nfs-server服务下载并修改yamlmkdir-p/root/yaml/addons/nfscd/root/yaml/addons/nfswgethttps://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nfs-server.yaml修改yaml内容,添加namespace[root@ku......
  • Elasticsearch 节点角色配置
    节点角色在Elasticsearch7.x中,节点角色标识了一个节点在集群中扮演的角色,不同的角色代表着节点具备不同的功能和责任。默认情况下,一个节点的角色为cdhilmrstw,即拥有所有角色。各角色含义为:C:Coordinator(协调节点)-该节点负责协调集群中的请求,并将请求路由到数据节点上,作......
  • Elasticsearch 集群网络配置实例
    网络配置在elasticsearch中,客户端通过http与es进行通信;es集群节点间主要通过transport进行通信。在不同的网络环境下,需要进行相应的网络配置调整。简单网络环境单网卡假设只有一个网络接口A,IP地址为176.33.2.101、http通信端口9200、transport通信端口9300。#监听的IPnetw......
  • Elasticsearch集群生产配置
    集群配置在组建集群时,需要额外添加集群相关的配置,如节点角色、集群发现、初始主节点、主节点选举和安全认证等,以下配置均在上篇创建Elasticsearch单机实例的基础上搭建。设置集群名称vielasticsearch.yml#统一集群名字cluster.name:my-application#移除该配置discover......