# 一、环境准备
|节点类别|主机名|IP|
|-|-|-|
|OBSERVER|observer1|192.168.3.41|
|OBSERVER|observer2|192.168.3.42|
|OBSERVER|observer3|192.168.3.43|
|ocp |ocpserver|192.168.3.47|
|中控机 |obcontrol|192.168.3.48|

# 二、名词解析

中控机:存储Oceanbase数据库安装包和集群配置信息的机器

目标机器:安装OceanBase数据库的机器

OBD:Oceanbase Deployer,Oceanbase 开源软件的安装部署工具,简称OBD

OBProxy:Oceanbase Database Proxy, OceanBase高性能反向代理服务器,简称OBProxy

OCP: OceanBase cloud Platform OceanBase运维管理工具,简称OCP

# 三、主机安装步骤
## 3.1 配置hosts文件和磁盘的规划
```
echo "192.168.3.41 observer1"> /etc/hosts
echo "192.168.3.42 observer2">> /etc/hosts
echo "192.168.3.43 observer3">> /etc/hosts
echo "192.168.3.47 ocpserver">> /etc/hosts
echo "192.168.3.48 obcontrol">> /etc/hosts
cat /etc/hosts

pvcreate /dev/sdb /dev/sdc
vgcreate redovg /dev/sdb
vgcreate datavg /dev/sdc
lvcreate -n datalv -L 200000M datavg
lvcreate -n adminlv -L 100000M datavg
lvcreate -n redolv -L 100000M redovg

mkfs.xfs /dev/datavg/datalv
mkfs.xfs /dev/datavg/adminlv
mkfs.xfs /dev/redovg/redolv

cat >> /etc/fstab << EOF
/dev/datavg/datalv /data xfs defaults 0 0
/dev/datavg/adminlv /home/admin xfs defaults 0 0
/dev/redovg/redolv /redo xfs defaults 0 0
EOF
cat /etc/fstab
```
## 3.2 创建目录和admin用户
```
mkdir -p /data/soft
mkdir /redo
mkdir /home/admin
mount /data
mount /home/admin
mount /redo
rm -fr /var/spool/mail/admin
userdel -r admin
groupadd -g 66000 admin
useradd -u 66000 -g admin -m -d /home/admin -s /bin/bash admin
cp /etc/skel/.bash* /home/admin/
echo "admin" | passwd --stdin admin

chown -R admin:admin /data
chown -R admin:admin /redo
chown -R admin:admin /home/admin

```
## 3.3 配置 sudoers文件和 字符集
```
cat >> /etc/sudoers << EOF
Admin ALL=(ALL) NOPASSWD: ALL
EOF

测试:
su - admin
sudo -su root
exit
exit;

echo "export LANG=en_US.UTF8" >> ~/.bash_profile
cat ~/.bash_profile

echo "export LANG=en_US.UTF8" >> /home/admin/.bash_profile
systemctl set-default multi-user.target
```
## 3.4 配置yum
```
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom

cd /etc/yum.repos.d
mkdir bk
mv -f *.repo bk/

vi /etc/yum.repos.d/oracle.repo
[Server]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=file:///media/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

yum install -y expect mariadb mariadb-devel python-devel openssl-devel gcc gcc-gfortran gcc-c++ python-setuptools bc et-tools mtr chrony bind-utils libaio tree

```
## 3.5 配置limits.conf和sysctl.conf
```

cat >> /etc/security/limits.conf << EOF
* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
* hard core unlimited
* soft core unlimited
* hard stack 10240
* soft stack 10240
* hard cpu unlimited
* soft cpu unlimited
EOF

cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
vm.swappiness=1
vm.max_map_count=655360
kernel.pid_max=819200
#vm.nr_hugepages = 0
kernel.core_pattern=/data/1/core-%e-%p-%t
vm.min_free_kbytes=204800
net.core.somaxconn=32768
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=10000 65535
net.ipv4.ip_forward=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.default.accept_source_route=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_tw_reuse=1
net.ipv4.tcp_slow_start_after_idle=0
EOF

sysctl -p

```
## 3.6 配置时间服务
```
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock

echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted " >> /etc/selinux/config
cat /etc/selinux/config
setenforce 0

systemctl stop firewalld.service
systemctl disable firewalld.service

cat >> /home/admin/.vimrc << EOF
map <F10>:set paste<CR>
map <F11>:set nopaste<CR>
EOF

cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never

cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

cat >> /etc/rc.d/rc.local << EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF

chmod +x /etc/rc.d/rc.local
/etc/rc.d/rc.local

# vim set_deadline.sh
for DISK in `ls /sys/block | grep "sd\?"` ; do echo deadline > /sys/block/$DISK/queue/scheduler ; done

yum -y install chrony

192.168.3.48:
/etc/chrony.conf

cp /etc/chrony.conf /etc/chrony.conf.bak
cat >> /etc/chrony.conf << EOF
server 127.127.1.0
allow 192.168.3.0/24
local stratum 10
EOF
systemctl start chronyd
systemctl enable chronyd

其他主机
cp /etc/chrony.conf /etc/chrony.conf.bak
cat >> /etc/chrony.conf << EOF
server 192.168.3.48
allow 192.168.3.0/24
local stratum 10
EOF

systemctl start chronyd
systemctl enable chronyd

timedatectl set-timezone Asia/Shanghai
chronyc -a makestep
chronyc sources -v
date

```
## 3.7 配置ssh
```
cd ssh
chmod u+x ssh
./ssh -user admin -hosts "observer1 observer2 observer3 observer4 observer5 observer6 ocpserver obcontrol " -advanced -exverify -confirm
chmod 600 /home/admin/.ssh/config
su - admin
ssh observer1 date
ssh observer2 date
ssh observer3 date
ssh observer4 date
ssh observer5 date
ssh observer6 date
ssh ocpserver date
ssh obcontrol date
```
# 四、 安装oceanbase

## 4.1 下载ob的软件 和上传软件
## 4.2 删除阿里云*.repo
```
cd /data
chown -R admin:admin soft
su - admin

cd /data/soft/
sudo rpm -ivh ob-deploy-1.2.1-9.el7.x86_64.rpm
source /etc/profile.d/obd.sh
rpm -ql `rpm -qa|grep ob-deploy`
obd mirror list

/bin/rm -rf ~/.obd/mirror/remote/*.repo

obd mirror clone /data/soft/*.rpm

obd mirror list local
```
## 4.3 配置 dbobce-3zones.yaml
```
cd /data
vi dbobce-3zones.yaml
:set paste

# Only need to configure when remote login is required
user:
username: admin
password: admin

oceanbase-ce:

servers:

- name: observer1

# Please don't use hostname, only IP can be supported

ip: 192.168.3.41

- name: observer2

ip: 192.168.3.42

- name: observer3

ip: 192.168.3.43

global:

# 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: enp0s3

cluster_id: 2

# please set memory limit to a suitable value which is matching resource.

memory_limit: 8G # The maximum running memory for an observer

system_memory: 3G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.

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

major_freeze_duty_time: Disable

minor_freeze_times: 10

enable_separate_sys_clog: 0

enable_merge_by_turn: FALSE

#datafile_disk_percentage: 3 # The percentage of the data_dir space to the total disk space. This value takes effect only when datafile_size is 0. The default value is 90.

datafile_size: 10G

syslog_level: WARN # System log level. The default value is INFO.

enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true.

enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.

max_syslog_file_count: 10 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.

# observer cluster name, consistent with obproxy's cluster_name

appname: eduobce

root_password: 123123 # root user password, can be empty

proxyro_password: rootroot # proxyro user pasword, consistent with obproxy's observer_sys_password, can be empty

observer1:

mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.

rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.

# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.

home_path: /home/admin/oceanbase-ce

# The directory for data storage. The default value is $home_path/store.

data_dir: /data

# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.

redo_dir: /redo

zone: zone1

observer2:

mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.

rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.

# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.

home_path: /home/admin/oceanbase-ce

# The directory for data storage. The default value is $home_path/store.

data_dir: /data

# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.

redo_dir: /redo

zone: zone2

observer3:

mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.

rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.

# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.

home_path: /home/admin/oceanbase-ce

# The directory for data storage. The default value is $home_path/store.

data_dir: /data

# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.

redo_dir: /redo

zone: zone3

obproxy:

servers:

- 192.168.3.41
- 192.168.3.42
- 192.168.3.43

# Set dependent components for the component.

# When the associated configurations are not done, OBD will automatically get the these configurations from the dependent components.

depends:

- oceanbase-ce

global:

listen_port: 2883 # External port. The default value is 2883.

prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.

home_path: /home/admin/obproxy

# oceanbase root server list

# format: ip:mysql_port;ip:mysql_port

rs_list: 192.168.3.41:2881;192.168.3.42:2881;192.168.3.43:2881

enable_cluster_checkout: false

# observer cluster name, consistent with oceanbase-ce's appname

cluster_name: eduobce

obproxy_sys_password: rootroot # obproxy sys user password, can be empty

observer_sys_password: rootroot # proxyro user pasword, consistent with oceanbase-ce's proxyro_password, can be empty
```

## 4.4安装eduobce
```
su - admin
obd cluster deploy eduobce -c dbobce-3zones.yaml
obd cluster list

obd cluster start eduobce
```
## 4.5 安装客户端
```
sudo rpm -ivh libobclient-2.0.0-2.el7.x86_64.rpm obclient-2.0.0-2.el7.x86_64.rpm

IPS="192.168.3.41 192.168.3.42 192.168.3.43"
for ob in $IPS;do echo $ob; ssh $ob "netstat -ntlp" ; done
```
## 4.6 查看集群状态
```
[admin@obcontrol ~]$ obd cluster display eduobce
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
Connect to observer ok
Wait for observer init ok
+------------------------------------------------+
| observer |
+--------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+--------------+---------+------+-------+--------+
| 192.168.3.41 | 3.1.2 | 2881 | zone1 | active |
| 192.168.3.42 | 3.1.2 | 2881 | zone2 | active |
| 192.168.3.43 | 3.1.2 | 2881 | zone3 | active |
+--------------+---------+------+-------+--------+

Connect to obproxy ok
+------------------------------------------------+
| obproxy |
+--------------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+--------------+------+-----------------+--------+
| 192.168.3.41 | 2883 | 2884 | active |
| 192.168.3.42 | 2883 | 2884 | active |
| 192.168.3.43 | 2883 | 2884 | active |
+--------------+------+-----------------+--------+
[admin@obcontrol ~]$
```

oceanbase 社区版安装的更多相关文章

  1. 【Git】 GitLab服务器社区版安装与配置

    GitLab简介 GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务 GitLab系统架构 当~git在图片中引用时,它表示git用户的主目录 ...

  2. MYSQL社区版安装手册

    https://www.jb51.net/article/140412.htm 在本教程中使用MySQL最新的MySQL服务8.0.11的社区绿色版本进行安装,绿色版为zip格式的包,安装分为以下四步 ...

  3. OpenAcc社区版安装教程(Linux版)(更新版)

    官方安装过程如下图所示 1.安装前 下载OpenAcc社区版 1,目前为止的最新版,平台是Linux,选择Linux x86-64. 我的服务器系统是CentOs 下载地址链接:https://www ...

  4. MySQL 社区版 安装小记

    根据刘铁猛老师的教程,自己折腾一下 1. 安装包准备 在Windows10 64bit上安装,故需要准备vc++ 2013和2015的Redistributable的包,搜索即有,无需细说. 示例数据 ...

  5. UOJ社区版安装多个Judger

    目录 声明 在同一台机器上安装 在不同机子上安装 声明 本文档非官方文档,为我试坑的经验总结. 本文编写时间 2019.11.04 ,并不一定会随UOJ更新而更新. 由于UOJ需要用SVN传题,并不那 ...

  6. pycharm社区版安装及遇到的问题

    1. 在官网上下载pycharm社区版安装包. 2. 按照该教程进行安装: https://jingyan.baidu.com/article/f00622286e92f4fbd2f0c855.htm ...

  7. 002.MongoDB社区版安装

    一 前期准备 1.1 相关软件包介绍 包裹名字 描述 mongodb-org 一个将自动安装以下四个组件包的组合包. mongodb-org-server 包含mongod守护程序,关联的init脚本 ...

  8. Gitlab 社区版安装部署和维护指南

    因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.这篇文章是在 Gitlab 7.4 的环境下配置的,相关内容可能已经过时. 后续做了一次迁移,将 Gitlab 升级到了 ...

  9. win10 Ubuntu子系统安装&odoo10社区版安装

    参考文档: http://www.cnblogs.com/odoouse/p/5995603.html https://www.jianshu.com/p/58090215bda8 一.win10 U ...

  10. Ubuntu 16.04 (官方命令行)安装MongoDB 3.6.2(社区版)

    概述 使用本教程从 .deb 包在LTS Ubuntu Linux系统上安装MongoDB Community Edition. 虽然Ubuntu包含自己的MongoDB包,但官方的MongoDB社区 ...

随机推荐

  1. 04-python垃圾回收机制

    python垃圾回收机制 一.引入 解释器在执行定义变量的语法时,会申请内存空间来存放变量值,每一块内存空间都有其唯一的内存地址,我们在前面说过,变量名并不是存放的变量值,而是存放的内存地址,通过访问 ...

  2. elements-plus 自动导入

    elements-plus 自动导入(官网推荐导入方式) 根据官网安装依赖 npm install -D unplugin-vue-components unplugin-auto-import 配置 ...

  3. 【面试题】面试突击71:GET 和 POST 有什么区别?

    携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第4天,点击查看活动详情 GET 和 POST 是 HTTP 请求中最常用的两种请求方法,在日常开发的 RESTful 接口中,都能 ...

  4. rtl8188eu 关闭power save

    RTL8188eu 关闭power saving 当PC端没有和设备交换数据时,rtl8188eu会进入节能模式,很影响调试开发. 关闭方法:找到驱动代码include/autoconf.h 发现要禁 ...

  5. 重启nginx 报错 nginx.pid

    先检查 nginx -c /etc/nginx/nginx.conf 看看端口是否被占用 若占用杀掉 ps -ef | grep nginx kill --- 然后再用nginx -c /etc/ng ...

  6. file、blob、base64相互转换

    blob blob转file const blob = '.....' const file = new File([blob], 'name.wav', {type: 'audio/wav'}); ...

  7. [Docker-2]排查基于docker部署mysql主从过程中遇到“Slave_IO_Running: Connecting”这个疑难杂症

    关于"Slave_IO_Running: Connecting"的排查方法,已经有很多博客写得清清楚楚了(很多都是复制粘贴..真浪费时间),那么如果已有的常规排查方法都不能解决你的 ...

  8. ZIAO日报 202302

    2023.2 2023年2月14日 10:23 2023.2.14 继续读<Multi-View Transformer for 3D Visual Grounding>,读到了relat ...

  9. Django初识(一)

    一.Django简介 Django是一个开放源代码的Web应用框架,由Python写成.采用了MTV的设计模式,即模型M,视图V和模版T 1.框架介绍 具体介绍Django之前,必须先介绍Web框架的 ...

  10. RocketMQ 如何保证消息不丢失,重复消费

    RocketMQ 如何保证消息不丢失 Producer 提供SYNC的发送消息方式,等待broker处理结果. 发送消息如果失败或者超时,则重新发送. // 同步发送消息,如果5秒内没有发送成功,则重 ...