OB-本地单节点部署社区版3.1部署环境
序号项⽬内容官⽅建议
1CPU2C CPU数量不低于2
2MEMOERY8G内存不低于16G
3DISK200G(/ob)N/A
4IP192.168.10.181可单机、分布式多种⽅式部署
5OS rhel 7.6
6oceanbase社区版3.1N/A
7
软件介质清单
共6个rpm包,下载后上传⾄安装主机soft⽬录。
OBD: OceanBase Database Deployer社区版部署⼯具
oceanbase-ce: OceanBase数据库社区版
OceanBase libs: oceanbase运⾏时所依赖的部分三⽅动态库
Obproxy : oceanbase数据库专⽤的代理服务器
OBClient:obclient交互式和批量处理查询⼯具
LibOBClient:obclient的依赖包
下载社区版软件
yum源上rpm包信息
下载软件
yum install -y yum-utils
yum-config-manager --add-repo mirrors.aliyun/po
# 创建⼀个⽬录⽤于下载
mkdir soft
cat > rpm_list <<EOF
oceanbase-ce-3.1.0-3.el7.x86_64.rpm
oceanbase-ce-libs-3.1.0-3.el7.x86_64.rpm
obproxy-3.1.0-1.el7.x86_64.rpm
obclient-2.0.0-2.el7.x86_64.rpm
ob-deploy-1.1.0-1.el7.x86_64.rpm
libobclient-2.0.0-2.el7.x86_64.rpm
oceanbase-ce-sql-parser-3.1.0-3.el7.x86_64.rpm
EOF
wget -B mirrors.aliyun/oceanbase/community/stable/el/7/x86_64/ -i rpm_list -P soft
# or
yum install obclient libobclient obproxy oceanbase-ce oceanbase-ce-libs ob-deploy --downloadonly --downloaddir=soft
yaml配置⽂件
在页⾯gitee/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml,拷贝mi
ni-local-example.yaml内容并保存为mini-local-example.yaml,上传⾄安装服务器soft⽬录。
cat > mini-local-example.yaml <<-EOF
oceanbase-ce:
servers:
# Please don't use hostname, only IP can be supported
- 127.0.0.1
global:
home_path: /root/observer
# Please set devname as the network adaptor's name whose ip is in the setting of severs.
# if set severs as "127.0.0.1", please set devname as "lo"
# if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0"
devname: lo
mysql_port: 2881
rpc_port: 2882
mysql社区版国内镜像下载zone: zone1
cluster_id: 1
# please set memory limit to a suitable value which is matching resource.
memory_limit: 8G
system_memory: 4G
stack_size: 512K
cpu_count: 16
cache_wash_threshold: 1G
__min_full_resource_pool_memory: 268435456
workers_per_cpu_quota: 10
schema_history_expire_time: 1d
# The value of net_thread_count had better be same as cpu's core number.
net_thread_count: 4
sys_bkgd_migration_retry_num: 3
minor_freeze_times: 10
enable_separate_sys_clog: 0
enable_merge_by_turn: FALSE
datafile_disk_percentage: 20
syslog_level: INFO
enable_syslog_recycle: true
max_syslog_file_count: 4
# root_password: # root user password, can be empty
EOF
操作系统配置
以下操作如⽆特别说明,均以root⽤户执⾏。
准备⼯作[root]
selinux关闭
#临时关闭
setenforce 0
getenforce
#开机不启动selinux,需重启⽣效。已临时关闭,本次不需要重启⽣效。
sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
#查看配置已⽣效
cat /etc/selinux/config
firewalld关闭
#关闭防⽕墙
systemctl stop firewalld
#开机不启动防⽕墙
systemctl disable firewalld
修改主机名
#修改主机名为oceanbase,当前已⽣效,退出会话,再登录后显⽰新主机名
hostnamectl set-hostname oceanbase
配置hosts
#主机名解析添加主机信息
cat >> /etc/hosts << EOF
192.168.10.182 oceanbase
EOF
#查看主机名信息
cat /etc/hosts
添加oceanbase⽤户
oceanbase安装和维护均由oceanbase⽤户操作。[⽣产的OB默认运⾏在admin⽤户]
#添加oceanbase⽤户
useradd ober
#更改密码
echo "ober" | passwd --stdin ober
#运⾏oceanbase可运⾏任何命令,不需要密码
visudo #添加oceanbase⼀⾏内容
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
ober ALL=(ALL) NOPASSWD: ALL
创建SSH 互信
安装⽬录准备
以root⽤户安装时,默认安装在/root/observer⽬录下,这⾥以oceanbase⽤户安装在/ob/observer⽬录下。查看默认安装路径
rpm -ql oceanbase-ce-3.1.0-3.el7.x86_64
for pkg in $(ls -tr ./*.rpm);do
echo $pkg; rpm -ql $pkg
done
⾃定义安装
# 查看安装⽬录⼤⼩
[root@progs oceanbase]# df -hT /ups
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/upsvg-upslv xfs 64G 44G 21G 69% /ups
[root@progs oceanbase]#
# 检查属主、属组
[root@progs oceanbase]# ls -ld /ups/app/oceanbase
drwxr-xr-x 2 ober ober 6 Aug 28 20:39 /ups/app/oceanbase
[root@progs oceanbase]#
#添加内容
echo "fs.aio-max-nr=1048576" >> /f
#配置⽣效
sysctl -p
# for oceanbase
## 修改内核异步 I/O 限制
fs.aio-max-nr=1048576
## ⽹络优化
net.ipv4.ip_local_port_range = 3500 65535
net.ipv4.ip_forward = 0
f.default.rp_filter = 1
f.default.accept_source_route = 0
p_syncookies = 0
p_rmem = 4096 87380 16777216
p_wmem = 4096 65536 16777216
p_max_syn_backlog = 16384
p_fin_timeout = 15
p_max_syn_backlog = 16384
p_tw_reuse = 1
p_tw_recycle = 1
p_slow_start_after_idle=0
vm.swappiness = 0
vm.min_free_kbytes = 2097152
# 此处为 OceanBase 数据库的 data ⽬录
<_pattern = /data/core-%e-%p-%t
其中,_pattern中的/data为 OceanBase 数据库的data⽬录。如果您只是测试,您可以只设置fs.aio-max-nr=1048576。
打开⽂件数限制
#添加内容
cat >> /etc/security/limits.f << EOF
ober soft nofile 655350
ober hard nofile 655350
root soft nofile 655350
root hard nofile 655350
EOF
# ⽣产环境建议配置
root soft nofile 655350
root hard nofile 655350
* soft nofile 655350
* hard nofile 655350
* soft stack 20480
* hard stack 20480
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
#退出当前会话,重新登录,使配置⽣效。
#检查open files当前值,应为655350,否则后续启动集会报错
ulimit -n
软件安装
下载并安装OBD[oceanbase⽤户]
获取OceanBase数据库最快的⽅式是使⽤数据库部署⼯具OceanBase Deployer(简称OBD),因此推荐使⽤此⽅式体验OceanBase数据库。在线安装安装OBD
通过 YUM 软件源安装 OBD
sudo yum install -y ob-deploy
source /etc/profile.d/obd.sh
离线安装OBD(即RPM包)
安装OBD
# oceanbase⽤户安装
sudo yum install -y ob-deploy-1.1.0-1.el7.x86_64.rpm
# ⽤户使变量⽣效
source /etc/profile.d/obd.sh
配置本地oceanbase镜像[oceanbase⽤户]
当前主机不能连接公⽹,将之前OceanBase数据库的rpm离线软件包镜像到本地。检查离线包
ls ./*.rpm
将OceanBase数离线软件包加⼊本地镜像
将OceanBase数据库的离线软件包加⼊本地镜像:
which obd
obd mirror clone *.rpm
clone命令执⾏后,将本地上rpm包复制到~/.obd/mirror⽬录上
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论