1 系统版本信息
[root@db01 ~]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
系统空间要求
内存不低于10G
磁盘空间不低于100G
2 OB软件下载
https://open.oceanbase.com/softwareCenter/community
[root@db01 ob]# ls
libobclient-2.0.0-2.el7.x86_64.rpm
ob-deploy-1.0.0-1.el7.x86_64.rpm
oceanbase-ce-3.1.0-1.el7.x86_64.rpm
obclient-2.0.0-1.el7.x86_64.rpm
obproxy-3.1.0-1.el7.x86_64.rpm
oceanbase-ce-libs-3.1.0-1.el7.x86_64.rpm
3 软件安装
rpm -ivh oceanbase-ce-*
rpm -ivh obclient-2.0.0-1.el7.x86_64.rpm
4 主机环境设置
/etc/sysctl.conf
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 = 0
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
vm.max_map_count=655360
fs.aio-max-nr=1048576
/etc/security/limits.conf
* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
setenforce 0
rpm -ivh oceanbase-ce-* rpm -ivh obclient-2.0.0-1.el7.x86_64.rpm
4 主机环境设置
/etc/sysctl.conf
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 = 0
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
vm.max_map_count=655360
fs.aio-max-nr=1048576
/etc/security/limits.conf
* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
setenforce 0
新建admin用户
# 新增普通用户 admin useradd admin # 改用户密码 passwd admin # 或下面命令指定密码,密码修改为自己的。 echo 'admin:adminPWD123' | chpasswd
5 启动OBSERVER
建立相关数据目录
su - admin echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/oceanbase/lib' >> ~/.bash_profile . ~/.bash_profile mkdir -p ~/oceanbase/store/obdemo /data/obdemo/{sstable,etc3} /redo/obdemo/{clog,ilog,slog,etc2} for f in {clog,ilog,slog,etc2}; do ln -s /redo/obdemo/$f ~/oceanbase/store/obdemo/$f ; done for f in {sstable,etc3}; do ln -s /data/obdemo/$f ~/oceanbase/store/obdemo/$f; done
启动observer
cd ~/oceanbase bin/observer -i ens192 -p 2881 -P 2882 -z zone1 -d ~/oceanbase/store/obdemo -r '192.168.5.200:2882:2881' -c 20210912 -n obdemo -o "memory_limit=8G,cache_wash_threshold=1G,__min_full_resource_pool_memory=268435456,system_memory=3G,memory_chunk_cache_size=128M,cpu_count=16,net_thread_count=4,datafile_size=50G,stack_size=1536K,config_additional_dir=/data/obdemo/etc3;/redo/obdemo/etc2"
进程状态检查
6 初始化集群
root 密码登陆2881,密码为空
obclient -h 192.168.5.200 -u root -P 2881 -p -c -A set session ob_query_timeout=1000000000; alter system bootstrap ZONE 'zone1' SERVER '192.168.5.200:2882';
7 登陆集群
OceanBase 集群的超级管理员 root@sys 的密码,默认是空,建议设置复杂的密码。
OceanBase 集群的超级管理员 root@sys 的密码,默认是空,建议设置复杂的密码。
登陆集群
obclient -h 192.168.5.200 -u root@sys -P 2881 -p -c -A
obclient -h 192.168.5.200 -u root@sys -P 2881 -p -c -A
8 obproxy配置
创建proxyro用户:
obclient -h 192.168.5.200 -u root@sys -P 2881 -p -c -A grant select on oceanbase.* to proxyro identified by 'SWoLCQRH' ;
启动proxy并配置密码
/home/admin/obproxy-3.1.0/bin/obproxy -r "127.0.0.1:2881" -p 2883 -o "enable_strict_kernel_release=false,enable_cluster_checkout=false,enable_metadb_used=false" -c obdemo
连接obproxy配置密码
通过root@proxysys用户连接到proxy,端口号2883,密码为空
obclient -h 127.0.0.1 -u root@proxysys -P 2883 -p alter proxyconfig set observer_sys_password = 'SWoLCQRH' ;
9 测试proxy
obclient -h127.1 -uroot@sys#obdemo -P2883 -c -A oceanbase
单节点的observer和obproxy配置完成。
10 启动命令说明和详解
OBServer 启动参数说明表
OBProxy
obproxy [OPTIONS] -h,--help print this help -p,--listen_port LPORT obproxy listen port -o,--optstr OPTSTR extra options string -n,--appname APPNAME application name -r,--rs_list RS_LIST root server list(format ip:sql_prot) -c,--cluster_name CLUSTER_NAME root server cluster name -N,--nodaemon don't run in daemon -V,--version VERSION current obproxy version -R,--releaseid RELEASEID current obproxy kernel release id
以下运行方式使用 admin 用户启动 obproxy 。
当没有 ocp 提供 config server 服务时, proxy 可以依赖 observer 的 rslist 直接启动。
假设 proxy 监听端口为 2883 , proxy 所在机房名为 hz001 ,使用 rslist 启动的集群名为 xxbank ,proxy 所属应用的名称为 trade 。
./bin/obproxy -p2883 -r'10.125.224.11:2881;10.125.224.22:2881;10.125.224.33:2881' -o proxy_idc_name='hz001' -c 'xxbank' -n trade
参考地址:
https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database-1-4/V1.4/ta6wc3
https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database-2-1/V2.1/muvm3c