OAT 安装
参考文档:这两个文档的安装方式也不一样,试了最后都是卡在判断端口占用这个地方······
https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000021048#b992eff3-aa6f-4144-bd91-cb9bc658de1e
https://www.oceanbase.com/docs/enterprise-oat-doc-cn-10000000000603664
而且容器内部并没有 oatcli 这个命令行工具,find 也没找到,比较坑。
安装 docker
一键安装,因为测试使用,所以 docker 安装就直接采用默认配置。
1
2
3
4
| ## 阿里云镜像安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
## 或者
curl -sSL https://get.daocloud.io/docker | sh
|
建议提前安装 docker,如果使用 oat 安装包内部的 docker,有可能容器就直接启动失败了。日志里也没看出什么问题。
手动加载 oat 镜像
成功步骤
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| scp 软件到服务器
unzip 软件
## 进入目录
cd /software/Oceanbase/oat/oat-all-in-one-x86
docker load -i oat_4.1.0_20230331_x86.tgz ## 加载 oat 压缩包解压之后的 tgz 文件,官网文档这点也没写明
oat_image=`docker images | grep oat | awk '{printf $1":"$2"\n"}'`
mkdir /data_dir
docker run -d --name oat -v /data_dir:/data -p 7000:7000 -p 3306:3306 --restart on-failure:5 $oat_image
## 进入容器修改启动脚本
docker exec -it 771233935c3b bash
## 注释之前请先手动确认端口未被占用
vim oat/distribution/prepare/init.sh
注释第是 38 行内容
|
1
2
3
4
5
6
7
8
9
10
11
12
| ## 注释之后手动重启 oat 容器
docker restart oat
## 验证 oat
[root@oat oat-all-in-one-x86]# netstat -anlp | grep 7000
tcp 0 0 0.0.0.0:7000 0.0.0.0:* LISTEN 14766/docker-proxy
tcp6 0 0 :::7000 :::* LISTEN 14772/docker-proxy
[root@oat oat-all-in-one-x86]# curl http://127.0.0.1:7000
## 或者浏览器打开网页 如果采用默认密码,在第一次登陆的时候会需要修改密码
http://192.168.187.129:7000/
|
踩坑
省略上传解压 oat 软件包步骤
加载启动 oat 容器
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
| [root@oat ~]# cd /software/Oceanbase/oat/oat-all-in-one-x86
[root@oat oat-all-in-one-x86]# ll
总用量 503368
drwxr-xr-x. 2 root root 89 3 月 31 14:27 components
-rw-r--r--. 1 root root 56262573 3 月 30 12:13 docker-18.09.9.tgz
-rwxr-xr-x. 1 root root 9965 3 月 31 19:37 install.sh
-rw-r--r--. 1 root root 459161794 4 月 3 18:29 oat_4.1.0_20230331_x86.tgz
-rw-r--r--. 1 root root 1020 3 月 31 17:09 readme.txt
drwxr-xr-x. 2 root root 4096 3 月 31 14:34 tools
## 加载 oat 镜像
[root@oat oat-all-in-one-x86]# docker load -i oat_4.1.0_20230331_x86.tgz
06f6bfff6616: Loading layer [==================================================>] 230.8MB/230.8MB
e1505344677e: Loading layer [==================================================>] 3.072kB/3.072kB
01ede0eada53: Loading layer [==================================================>] 690.2MB/690.2MB
78073091fd9e: Loading layer [==================================================>] 8.704kB/8.704kB
5d96997aeb89: Loading layer [==================================================>] 232.8MB/232.8MB
17fa9a0a477e: Loading layer [==================================================>] 156.1MB/156.1MB
Loaded image: reg.docker.alibaba-inc.com/oceanbase/oat:4.1.0_20230331_x86
## 启动 oat 容器
[root@oat oat-all-in-one-x86]# oat_image=`docker images | grep oat | awk '{printf $1":"$2"\n"}'`
[root@oat oat-all-in-one-x86]# echo $oat_image
reg.docker.alibaba-inc.com/oceanbase/oat:4.1.0_20230331_x86
[root@oat oat-all-in-one-x86]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@oat oat-all-in-one-x86]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
reg.docker.alibaba-inc.com/oceanbase/oat 4.1.0_20230331_x86 c4a217d388ea 5 months ago 1.28GB
[root@oat oat-all-in-one-x86]# docker run -d --net host --name oat -v /data_dir:/data --restart on-failure:5 c4a217d388ea
771233935c3b90628f6e3657cd1a51fd239944f97b4347ceb01cf6e20278e291
##
|
验证检查容器
1
2
3
4
5
6
| [root@oat oat-all-in-one-x86]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
771233935c3b c4a217d388ea "/oat/distribution/p…" 4 seconds ago Up 2 seconds oat
[root@oat oat-all-in-one-x86]#
[root@oat oat-all-in-one-x86]# netstat -anlp | grep 7000
[root@oat oat-all-in-one-x86]#
|
查看默认 7000 端口未被监听,查看容器日志
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| [root@oat oat-all-in-one-x86]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
771233935c3b c4a217d388ea "/oat/distribution/p…" 33 seconds ago Up 31 seconds oat
[root@oat oat-all-in-one-x86]# docker logs -f -t 771233935c3b
2023-09-25T14:59:08.088278276Z + maria_root_password=MsF_DjxA2N3
2023-09-25T14:59:08.088460349Z + maria_port=3306
2023-09-25T14:59:08.088480554Z + DEPLOY_MODE=generic
2023-09-25T14:59:08.088491524Z + trap clean SIGHUP SIGINT SIGQUIT SIGTERM
2023-09-25T14:59:08.090491828Z + '[' 1 -ne 1 ']'
2023-09-25T14:59:08.090527256Z + '[' auto = initdb ']'
2023-09-25T14:59:08.090538613Z + '[' auto = auto ']'
2023-09-25T14:59:08.090802504Z + prepare_soft_links
2023-09-25T14:59:08.090822908Z + '[' '!' -f /oat/manage.py ']'
2023-09-25T14:59:08.090833688Z + chmod 755 /data
2023-09-25T14:59:08.101254358Z + mkdir -p /data/images /data/db /data/logs /data/binary_packages
2023-09-25T14:59:08.110393625Z + mkdir -p /data/logs/tasks
2023-09-25T14:59:08.118378616Z + '[' -L /oat/task_engine/logs ']'
2023-09-25T14:59:08.118629642Z + rm -rf /oat/task_engine/logs
2023-09-25T14:59:08.126820978Z + ln -s /data/logs/tasks /oat/task_engine/logs
2023-09-25T14:59:08.135673359Z + initdb
2023-09-25T14:59:08.135712560Z + '[' -n '' ']'
2023-09-25T14:59:08.135725024Z + start_local_db
2023-09-25T14:59:08.136070311Z + lsof -i:3306
|
进入容器检查
1
2
3
4
5
6
7
| ## 发现容器内部就只有如下两个进程,等待几分钟之后还是没有继续往下执行
[root@oat oat]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 22:59 ? 00:00:00 bash /oat/distribution/prepare/init.sh auto
root 12 1 99 22:59 ? 00:01:31 lsof -i:3306
root 13 0 0 23:00 pts/0 00:00:00 bash
root 28 13 0 23:00 pts/0 00:00:00 ps -ef
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| ## 查看 /oat/distribution/prepare/init.sh
[root@9803451aed14 oat]# bash /oat/distribution/prepare/init.sh --help
+ maria_root_password=MsF_DjxA2N3
+ maria_port=3306
+ DEPLOY_MODE=generic
+ trap clean SIGHUP SIGINT SIGQUIT SIGTERM
+ '[' 1 -ne 1 ']'
+ '[' --help = initdb ']'
+ '[' --help = auto ']'
+ '[' --help = upgrade ']'
+ echo 'unsupported arg --help'
unsupported arg --help
+ usage
+ cat
Usage: /oat/distribution/prepare/init.sh {initdb, auto}
initdb: create or upgrade meta only
auto: initdb and start process
+ exit 1
|
1
2
3
4
5
6
7
8
9
| ## 修改初始化脚本内容 将第 38 行的判断方法注释之后重启容器
[root@9803451aed14 oat]# vi /oat/distribution/prepare/init.sh
36 # 启动 db
37 function start_local_db() {
38 #lsof -i:"$maria_port" && { echo "DB port $maria_port is already used, please check!"; exit 1; }
39 if ! grep -q "port=" /etc/my.cnf.d/server.cnf; then # new empty file
40 cat /oat/distribution/prepare/server.cnf > /etc/my.cnf.d/server.cnf
41 fi
|
容器提示 iptable 异常
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
| ## 出现以下异常的话 重启容器服务 systemctl restart docker
[root@oat oat-all-in-one-x86]# docker rm oat
oat
[root@oat oat-all-in-one-x86]# docker run -d --name oat -v /data_dir:/data -p 7000:7000 -p 3306:3306 --restart on-failure:5 $oat_image
5b6681c44c086ab391c691d5ee562f87e72be263819be1afed8379226ec52126
docker: Error response from daemon: driver failed programming external connectivity on endpoint oat (02e89df7d352fcc60a07ab8fb57b3e46484b5716155b30aa5c697e99f64cea74): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 7000 -j DNAT --to-destination 172.17.0.2:7000 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).
[root@oat oat-all-in-one-x86]#
[root@oat oat-all-in-one-x86]#
[root@oat oat-all-in-one-x86]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
Active: inactive (dead) since Mon 2023-09-25 23:10:01 CST; 25min ago
Duration: 24min 40.641s
Docs: man:firewalld(1)
Process: 849 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 849 (code=exited, status=0/SUCCESS)
CPU: 5.436s
9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -F DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -F DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:11 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -D FORWARD -i docker0 -o do>9 月 25 23:10:00 oat systemd[1]: Stopping firewalld - dynamic firewall daemon...
9 月 25 23:10:01 oat systemd[1]: firewalld.service: Deactivated successfully.
9 月 25 23:10:01 oat systemd[1]: Stopped firewalld - dynamic firewall daemon.
9 月 25 23:10:01 oat systemd[1]: firewalld.service: Consumed 5.436s CPU time.
[root@oat oat-all-in-one-x86]# date
2023 年 09 月 25 日 星期一 23:36:00 CST
[root@oat oat-all-in-one-x86]#
[root@oat oat-all-in-one-x86]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
Active: inactive (dead) since Mon 2023-09-25 23:10:01 CST; 26min ago
Duration: 24min 40.641s
Docs: man:firewalld(1)
Process: 849 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 849 (code=exited, status=0/SUCCESS)
CPU: 5.436s
9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -F DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -F DOCKER-ISOLATI>9 月 25 22:55:10 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t filter -X DOCKER-ISOLATI>9 月 25 22:55:11 oat firewalld[849]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w10 -D FORWARD -i docker0 -o do>9 月 25 23:10:00 oat systemd[1]: Stopping firewalld - dynamic firewall daemon...
9 月 25 23:10:01 oat systemd[1]: firewalld.service: Deactivated successfully.
9 月 25 23:10:01 oat systemd[1]: Stopped firewalld - dynamic firewall daemon.
9 月 25 23:10:01 oat systemd[1]: firewalld.service: Consumed 5.436s CPU time.
...skipping...
|
oat 添加服务器
第一次登录需要修改密码,进入界面之后添加服务器。添加服务器的时候如果 centos/redhat 版本大于 8 的话,会检查不通过,在检查的脚本里写死了支持的服务器内核和版本。
最开始我的机器使用的是 centos stream 9,所以添加服务器的时候检查不通过。
修改机器为 centos7之后重新添加机器,在检查服务器的配置时,不满足资源需求,手动将任务设置为成功,成功添加服务器。
安装 observer
挂载磁盘
添加两块独立的 100g 磁盘用于存放日志和数据。
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
| ## 分区
[root@thedarkstar ~]# fdisk /dev/sdb
## 格式化
[root@thedarkstar ~]# mkdir /data/log1 -p
[root@thedarkstar ~]# mkdir -p /data/1
[root@thedarkstar ~]# mkfs.ext4 /dev/sdb
sdb sdb1
[root@thedarkstar ~]# mkfs.ext4 /dev/sdb1
## 挂载
[root@thedarkstar ~]# mount /dev/sdb1 /data/log1/
[root@thedarkstar ~]# mount /dev/sdc1 /data/1
## 开启自动挂载
[root@thedarkstar ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Sep 26 17:47:33 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=4d1accfd-3f49-417f-9a6c-bcd3d0d7ce33 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/sdb1 /data/log1 ext4 defaults 1 1
/dev/sdc1 /data/1 ext4 defaults 1 1
|
安装 observer
1
2
3
4
5
6
7
8
9
| [root@ob3 ~]# cd /software/Oceanbase/ob/
[root@ob3 ob]# ll
total 657016
-rw-r--r--. 1 root root 672783996 Sep 26 18:32 oceanbase-3.2.4.1-101000052023010822.el7.x86_64.rpm
[root@ob3 ob]# rpm -ivh oceanbase-3.2.4.1-101000052023010822.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:oceanbase-3.2.4.1-101000052023010################################# [100%]
[root@ob3 ob]#
|
配置目录
卸载/停止 observer
清理
1
2
3
4
5
6
| export cluster_name=obcluster
[root@xxx /home/admin]# rm -rf /data/1/$cluster_name
[root@xxx /home/admin]# rm -rf /data/log1/$cluster_name
[root@xxx /home/admin]# rm -rf /home/admin/oceanbase/store/$cluster_name
[root@xxx /home/admin]# rm -rf /home/admin/oceanbase/log/* /home/admin/oceanbase/etc/*config*
|
创建目录
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| ##切换到 admin 用户##
[root@xxx /home/admin]# su - admin
export cluster_name=obcluster
##使用 admin 用户执行以下命令##
[admin@ob3 ~]$ export cluster_name=obcluster
[admin@ob3 ~]$ mkdir -p /data/1/$cluster_name/{etc3,sort_dir,sstable,slog}
[admin@ob3 ~]$ mkdir -p /data/log1/$cluster_name/{clog,etc2,ilog,oob_clog}
[admin@ob3 ~]$ mkdir -p /home/admin/oceanbase/store/$cluster_name
[admin@ob3 ~]$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; done
[admin@ob3 ~]$ ll /data/1
total 20
drwx------. 2 root root 16384 Sep 26 18:36 lost+found
drwxrwxr-x. 6 admin admin 4096 Sep 26 22:22 obcluster
[admin@ob3 ~]$ ll /data/1/obcluster/
total 16
drwxrwxr-x. 2 admin admin 4096 Sep 26 22:22 etc3
drwxrwxr-x. 2 admin admin 4096 Sep 26 22:22 slog
drwxrwxr-x. 2 admin admin 4096 Sep 26 22:22 sort_dir
drwxrwxr-x. 2 admin admin 4096 Sep 26 22:22 sstable
[admin@ob3 ~]$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; done
|
初始化 observer
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
| ## cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer {-I $ip | -i $devname} -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r '$ip:2882:2881' -c $cluster_id -n $cluster_name -o "system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
ip='192.168.187.130'
rpc_port=2882
sql_port=2881
zone_name=zone1
cluster_name=obcluster
cluster_id=1000000001
cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r "'${ip}:2882:2881'" -c $cluster_id -n $cluster_name -o "__min_full_resource_pool_memory=1073741824,system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
##########################
cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -I $ip -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r "'${ip}:2882:2881'" -c $cluster_id -n $cluster_name -o "system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
## 比较坑 并没有-I 选项 取消-I 选项之后成功启动 另外-p -P 的端口最开始也写反了 丢
cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r "'${ip}:2882:2881'" -c $cluster_id -n $cluster_name -o "system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
[admin@ob3 ~]$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r "'${ip}:2882:2881'" -c $cluster_id -n $cluster_name -o "system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
/home/admin/oceanbase/bin/observer -P 2881 -p 2882 -z zone1 -d /home/admin/oceanbase/store/obcluster -r '192.168.187.130:2882:2881' -c 1000000001 -n obcluster -o system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/obcluster/etc3;/data/log1/obcluster/etc2
rpc port: 2881
mysql port: 2882
zone: zone1
data_dir: /home/admin/oceanbase/store/obcluster
rs list: '192.168.187.130:2882:2881'
cluster id: 1000000001
appname: obcluster
optstr: system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/obcluster/etc3;/data/log1/obcluster/etc2
[admin@ob3 oceanbase]$
[admin@ob3 oceanbase]$
[admin@ob3 oceanbase]$ ps -fu admin
UID PID PPID C STIME TTY TIME CMD
admin 21030 21029 0 23:15 pts/1 00:00:00 -bash
admin 21073 1 99 23:18 ? 00:00:16 /home/admin/oceanbase/bin/observer -P 2881 -p 2882 -z zone1 -d /home/a
admin 21133 21073 35 23:19 ? 00:00:02 /home/admin/oceanbase/bin/obesi -d -p 2881 -c 1000000001
admin 21259 21030 0 23:19 pts/1 00:00:00 ps -fu admin
[admin@ob3 oceanbase]$
[root@ob3 tools]# netstat -ntlp | grep 288
tcp 0 0 0.0.0.0:2881 0.0.0.0:* LISTEN 21073/observer
tcp 0 0 0.0.0.0:2882 0.0.0.0:* LISTEN 21073/observer
[root@ob3 tools]#
|
参数 |
说明 |
-I |
-i |
-p |
指定服务端口号,一般指定为 2881 。 |
-P |
指定 RPC 端口号,一般指定为 2882 。 |
-n |
指定集群名称。可自定义,不同集群名称不要重复即可。 |
-z |
指定启动的 observer 进程所属的 Zone。 |
-d |
指定集群主目录,初始化目录时创建的目录。除集群名字 $cluster_name 外,其他不要变动。 |
-c |
指定集群 ID。为一组数字,可以自定义,不同集群不要重复即可。 |
-l |
指定日志级别。 |
-r |
指定 RS 列表,格式是 $ip:2882:2881 ,分号分割,表示 Root Service 信息。 |
-o |
指定集群启动参数,需要根据实际情况设置。system_memory :指定 OceanBase 内部保留内存,默认是 30G ,机器内存比较少的情况下把这个调小,影响就是可能在性能测试时有内存不足问题。datafile_size :指定 OceanBase 数据文件 sstable 的大小(一次性初始化),根据 /data/1/ 可用空间评估,建议不少于 100G ,同时又保留一些剩余空间。config_additional_dir 指定参数文件的冗余目录。 |
system_memory
用于设置系统预留给租户 ID 为 500
的租户的内存容量。
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
| [admin@ob3 oceanbase]$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -I $ip -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r '${ip}:2882:2881' -c $cluster_id -n $cluster_name -o "system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
/home/admin/oceanbase/bin/observer -I 192.168.187.130 -P 2881 -p 2882 -z zone1 -d /home/admin/oceanbase/store/obcluster -r ${ip}:2882:2881 -c 1000000001 -n obcluster -o system_memory=4G,datafile_size=90G,config_additional_dir=/data/1/obcluster/etc3;/data/log1/obcluster/etc2
/home/admin/oceanbase/bin/observer: invalid option -- 'I'
observer [OPTIONS]
-h,--help print this help
-z,--zone ZONE zone
-p,--mysql_port PORT mysql port
-P,--rpc_port PORT rpc port
-N,--nodaemon don't run in daemon
-n,--appname APPNAME application name
-c,--cluster_id ID cluster id
-d,--data_dir DIR OceanBase data directory
-i,--devname DEV net dev interface
-o,--optstr OPTSTR extra options string
-r,--rs_list RS_LIST root service list
-l,--log_level LOG_LEVEL server log level
-6,--ipv6 USE_IPV6 server use ipv6 address
-m,--mode MODE server mode
-f,--scn flashback_scn
## 没有--version 选项 但是可以使用······
[admin@ob3 ~]$ observer --version
observer --version
observer (OceanBase 3.2.4.1)
REVISION: 101000052023010822-346aa35c32e99d1b82d713f75f0072c45bdf7aab
BUILD_BRANCH: HEAD
BUILD_TIME: Jan 8 2023 22:52:43
BUILD_FLAGS: RelWithDebInfo
BUILD_INFO:
Copyright (c) 2011-2020 Alipay Inc.
|
连接测试
安装 obclient
1
2
3
4
5
6
7
8
| [root@ob3 ~]# cd /software/Oceanbase/tools/
[root@ob3 tools]# rpm -ivh obclient-2.2.1-20221122151945.el7.alios7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:obclient-2.2.1-20221122151945.el7################################# [100%]
[root@ob3 tools]# which obclient
/usr/bin/obclient
[root@ob3 tools]#
|
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
| [root@oat oat-all-in-one-x86]# ls
components docker-18.09.9.tgz install.sh oat_4.1.0_20230331_x86.tgz readme.txt tools
[root@oat oat-all-in-one-x86]# cd tools/
[root@oat tools]# ls
obclient-2.2.1-20221122151945.el7.alios7.x86_64.rpm
oblb_140.tar
ob-loader-dumper-4.1.0-RELEASE.zip
ob-opstoolkit-1.2.0-20230310155004.el7.x86_64.rpm
ob-sysbench-1.0.20-11.el7.x86_64.tar
oceanbase-diagnostic-tool-1.2.0-20230223141142.alios7.x86_64.rpm
sql-diagnoser-2.1.0.zip
[root@oat tools]# du -sh .
295M .
[root@oat tools]# ll ../components/
总用量 885352
-rw-r--r--. 1 root root 741434405 3 月 31 14:26 meta_OB2277_OBP329_x86_20230330.tgz
-rw-r--r--. 1 root root 165162494 3 月 31 14:23 nlb_3.5.1_20230210194413_x86.tgz
[root@oat tools]# cd ..
[root@oat oat-all-in-one-x86]# scp tools/ 192.168.187.130:/software/Oceanbase/ -r
-r: No such file or directory
[root@oat oat-all-in-one-x86]# scp -r tools/ 192.168.187.130:/software/Oceanbase/
The authenticity of host '192.168.187.130 (192.168.187.130)' can't be established.
ED25519 key fingerprint is SHA256:QFZxRDADhGyyuW12dYxxhY7jPAOLgKbwqEadiGIBa6Q.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.187.130' (ED25519) to the list of known hosts.
[email protected]'s password:
ob-opstoolkit-1.2.0-20230310155004.el7.x86_64.rpm 100% 9930KB 33.9MB/s 00:00
oceanbase-diagnostic-tool-1.2.0-20230223141142.alios7.x86_64.rpm 100% 54MB 28.7MB/s 00:01
obclient-2.2.1-20221122151945.el7.alios7.x86_64.rpm 100% 10MB 28.5MB/s 00:00
ob-loader-dumper-4.1.0-RELEASE.zip 100% 106MB 34.0MB/s 00:03
sql-diagnoser-2.1.0.zip 100% 85MB 32.3MB/s 00:02
ob-sysbench-1.0.20-11.el7.x86_64.tar 100% 1920KB 25.9MB/s 00:00
oblb_140.tar 100% 28MB 21.6MB/s 00:01
[root@oat oat-all-in-one-x86]#
|
obclient 连接
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| ## 密码默认为空
[admin@ob3 ~]$ obclient -h127.0.0.1 -P2881 -uroot@sys -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221225473
Server version: OceanBase 3.2.4.1 (r101000052023010822-346aa35c32e99d1b82d713f75f0072c45bdf7aab) (Built Jan 8 2023 22:52:43)
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;
ERROR 1146 (42S02): Table 'oceanbase.__all_database' doesn't exist
obclient [(none)]> SET SESSION ob_query_timeout=1000000000;
Query OK, 0 rows affected (0.005 sec)
obclient [(none)]> show databases;
ERROR 1146 (42S02): Table 'oceanbase.__all_database' doesn't exist
obclient [(none)]>
|
集群 bootstrap 操作
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| ## 因为上文指定的端口反了 此处 rpc 是 2882
obclient [(none)]> SET SESSION ob_query_timeout=1000000000;
ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '192.168.187.130:2882';
obclient [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| SYS |
| LBACSYS |
| ORAAUDITOR |
| test |
+--------------------+
7 rows in set (0.037 sec)
|
手动部署的,命令行启动的时候没有指定__min_full_resource_pool_memory ,这个参数有默认值吗(是多大呢)? - 社区问答- OceanBase 社区-分布式数据库
经测试需要在初始化启动 observer 的时候指定该参数
1
2
3
4
5
6
| obclient [(none)]> ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '192.168.187.130:2881';
ERROR 1235 (0A000): unit min memory less than __min_full_resource_pool_memory not supported
obclient [(none)]>
alter system __min_full_resource_pool_memory = 1073741824 ;
|