分享知识,分享快乐

0%

部署 OceanBase 集群环境

部署 OceanBase 集群环境

磁盘初始化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
umount /dfs/data{1..8}

pvcreate /dev/nvme{0..7}n1 -y

vgcreate /dev/obvg /dev/nvme0n1 /dev/nvme1n1 /dev/nvme2n1 /dev/nvme3n1 /dev/nvme4n1 /dev/nvme5n1 /dev/nvme6n1 /dev/nvme7n1

# 日志盘 ,内存的三倍
lvcreate -n ob-log -L 3096G obvg --stripes=6 --stripesize=128
lvcreate -n ob-data -l 100%Free obvg --stripes=6 --stripesize=1024

mkfs.ext4 /dev/obvg/ob-log -O 64bit
mkfs.xfs /dev/obvg/ob-data

mkdir -p /data/{1,log1} && chmod -R 755 /data
vi /etc/fstab
/*写入*/
/dev/obvg/ob-data /data/1 xfs defaults,noatime,nodiratime 0 0
/dev/obvg/ob-log /data/log1 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0 0 0
mount -a

问题: OBD-4300:x.x.x.x: failed to query java version, you may not have java installed

解决方法:

1
ln -s /usr/java/jdk1.8.0_181-cloudera/bin/java  /usr/bin/java

在线部署

当您选择在线部署时,可以参考本节命令在中控机上安装 OBD。

1
2
3
4
[admin@test001 ~]$ sudo yum install -y yum-utils
[admin@test001 ~]$ sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
[admin@test001 ~]$ sudo yum install -y ob-deploy
[admin@test001 ~]$ source /etc/profile.d/obd.sh

步骤二:使用白屏部署 OceanBase 数据库

  1. 命令行执行 obd web 命令启动白屏界面,根据输出地址登录白屏界面并单击 开启体验之旅 开始部署。

    1
    2
    3
    [admin@test001 ~]$ obd web
    start OBD WEB in 0.0.0.0:8680
    please open http://172.xx.xxx.233:8680

OBD 一键测试

1
2
3
4
5
6
7
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install obtpch
sudo ln -s /usr/tpc-h-tools/tpc-h-tools/ /usr/local/
obd test tpch myoceanbase --test-server 10.0.19.191 --tenant=ocp -s 100 --remote-tbl-dir=/tmp/tpch100

obd test tpch myoceanbase --tenant=ocp --test-only

注意

  • OBD 运行 tpch,详细参数介绍请参考 obd test tpch
  • 在本例中,大幅参数使用的是默认参数,在用户场景下,可以根据自己的具体情况做一些参数上的调整。例如,在本例中使用的集群名为 myoceanbase,租户名是 ocp
  • -s 100 自动生成测试数据的规模,单位:G。

使用 OBD

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
obd cluster list
obd cluster restart myoceanbase
查看集群列表
obd cluster list

# 查看集群状态,以部署名为 myoceanbase 为例
obd cluster display myoceanbase

# 停止运行中的集群,以部署名为 myoceanbase 为例
obd cluster stop myoceanbase

# 销毁已部署的集群,以部署名为 myoceanbase 为例
obd cluster destroy myoceanbase

obd cluster autodeploy

obd cluster deploy
obd cluster start
obd cluster stop
obd cluster reload
obd cluster upgrade
obd cluster edit-config myoceanbase


部署集群
obd cluster deploy myoceanbase -c config.yaml
# 启动集群
obd cluster start myoceanbase

# 重启集群组件
obd cluster stop myocp -c ocp-server-ce --wp
obd cluster start myocp -c ocp-server-ce --wp
obd cluster restart myocp -c oceanbase-ce --wp

导入数据

并小于 2倍租户CPU就行

bin/obloader -hxx.xx.xx.xx -P端口 -u用户名 -t租户名 -D数据库名 -p --table ‘*’ --par --external-data --file-suffix ‘.tbl’ -f /data/0/xxx/tpch/100g_data/ --truncate-table --thread 32 --rpc-port 11208 --direct --parallel 32

t_history_trans_ethereum.ctrl

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
lang=java
(
address "none" map(1),
hash "none" map(3),
pk_hex "none" map(2),
hash_code "none" map(4),
reorg "none" map(5),
chain "none" map(6),
block_number "none" map(7),
block_timestamp "none" map(8),
transaction_type "none" map(9),
transaction_index "none" map(10),
nonce "none" map(11),
receipt_status "none" map(12),
from_address "none" map(13),
to_address "none" map(14),
value "none" map(15),
price "none" map(16),
amount "none" map(17),
function_code "none" map(18),
action "none" map(19),
gas_used "none" map(20),
gas_price "none" map(21),
transaction_fee "none" map(22)
);

– 先单个文件测试, 并指定控制文件

1
bin/obloader -h172.20.192.146 -P2881 -uroot -tbf -Daddress -p --table 't_history_trans_ethereum' --par --external-data -f /dfs/data3/data-source-dir/part-04999-cb9f741d-fb71-4423-9890-9ed42da9270d-c000.snappy.parquet --ctl-path /home/hadoop/controls

– 开启旁路,从hdfs批量导入

1
bin/obloader -h172.20.192.146 -P2881 -uroot -tbf -Daddress -p --table 't_history_trans_bsc' --par --external-data  --file-regular-expression '.*\.parquet' --file-suffix '.parquet' -f /dfs/data3/data-source-dir --storage-uri 'hdfs://ns1/user/hive/warehouse/test.db/history_bsc/?hdfs-site-file=/dfs/data3/data-source-dir/hadoop-conf/hdfs-site.xml&core-site-file=/dfs/data3/data-source-dir/hadoop-conf/core-site.xml' --rpc-port 2882 --direct --thread 64 --parallel 16

obdiag

1
2
3
4
source /usr/local/oceanbase-diagnostic-tool/init.sh
obdiag check -- 一键巡检
obdiag analyze log --since 30m
obdiag analyze flt_trace --flt_trace_id 00060d0f-aa35-8aec-3195-f6c9eb13b800