ubuntu优麒麟安装oceanbase单机社区版图形界面方式
参考另一篇文章:https://www.cnblogs.com/HaiHong/p/18149211
一、准备工作:
安装好openssh-server:
sudo apt update sudo apt install openssh-server -y sudo systemctl enable --now ssh
设置允许密码登陆:

也可以用nano /etc/ssh/sshd_config命令修改。
然后重启ssh服务。
systemctl restart ssh
2、设置打开文件数(两个文件需要改):
/etc/security/limits.conf
/etc/sysctl.conf
/etc/security/limid.d/nofile.conf
nano /etc/security/limits.conf
或者图形界面修改:

ubuntu同时要修改:
nano /etc/sysctl.conf

查看文件数量设置:
ulimit -n
直接修改文件数量(本次终端有效):
ulimit -n 65535
3.报错oceanbasea[ERROR] OBD-1007: (127.0.0.1) The value of the ulimit parameter "open files" must not be less than 20000 (Current value: 1024
# 切换到 root 用户(若已为 root 可跳过)
sudo su -
[ERROR] OBD-1007:
(127.0.0.1) The value of the ulimit parameter "open files" must not be
less than 20000 (Current value: 1024), Please execute `echo -e "* soft
nofile 20000\n* hard nofile 20000" >>
/etc/security/limits.d/nofile.conf` as root in 127.0.0.1. if it dosen't
work, please check whether UsePAM is yes in /etc/ssh/sshd_config.
# 执行 OBD 建议的命令,添加 nofile 配置
echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf
# 验证配置是否写入成功
cat /etc/security/limits.d/nofile.conf
* soft nofile 20000
* hard nofile 20000
# 编辑 sshd_config 文件
vi /etc/ssh/sshd_config
# 找到 UsePAM 这一行,确保值为 yes(去掉注释,修改值)
UsePAM yes
# 保存退出后,重启 sshd 服务使配置生效
systemctl restart sshd
# 退出当前 root 会话
exit
# 重新登录服务器(或重新 ssh 连接),然后检查配置是否生效
ulimit -n
# 正确输出应为 20000
二、安装obd(oceanBase Deployer):
下载地址:https://www.oceanbase.com/softwarecenter
官方文档:https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000004475429
图像化安装:https://www.oceanbase.com/docs/common-obd-cn-1000000005246368
1,打开oceanbase.com下载all-in-one包,解压缩到 /home/haihong/oceanbase-all-in-one/ 下,因为我没发现自动创建隐藏文件夹~/.oceanbase-all-in-one
2,安装obd:
官方文档(安装和卸载obd):https://www.oceanbase.com/docs/common-obd-cn-1000000003415274
tar -xzf oceanbase-all-in-one-*.tar.gz cd oceanbase-all-in-one/bin/ ./install.sh source ~/.oceanbase-all-in-one/bin/env.sh
3,打开web模式:
obd web

浏览器打开网址:http://127.0.1.1:8680/
4,一步步往下走。哪里出问题再解决那里的问题。




5,部署,等待完成。

6,测试
三、简单快速版安装:
官方文档:https://www.oceanbase.com/docs/common-obd-cn-1000000005246286
1, obd perf
#全部安装 obd perf obd perf -password 密码 #部分安装,参考:https://www.oceanbase.com/docs/common-obd-cn-1000000005246286#tableContainer obd perf -c oceanbase-ce,obproxy-ce,obagent
不写密码,安装后有个提示:

没有密码的话,一定要记好这个。
obclient -h127.0.0.1 -P2881 -uroot@sys -p'aXxQWknT4GQnMrR7fpJP' -Doceanbase -A
3,修改密码
-- 方式1:通用兼容语法(推荐) ALTER USER root@sys IDENTIFIED BY '新密码'; -- 方式2:OceanBase 原生语法(效果一致) SET PASSWORD FOR root@sys = PASSWORD('新密码');
忘记密码的补救措施,需要群管理权限:
ob_admin reset_sys_password --new-password '新密码' --tenant sys
4,查看cluster: obd cluster list
obd cluster start perf
obd cluster --help
5,配置开机启动:
新建一个服务,启动是 obd cluster start perf,停止是obd cluster stop perf
nano /etc/systemd/system/oceanbase .service
[Unit] Description=oceanbase After=network.target # 忽略启动超时(核心配置) StartLimitIntervalSec=0 [Service] # 启动类型。 simple:适配阻塞式启动 Type=forking #Type=forking User=root Group=root #EnvironmentFile=/root/.oceanbase-all-in-one/bin/env.sh # 设置启动超时时间(比如 300 秒,根据实际启动耗时调整) TimeoutStartSec=600 ExecStart=/home/haihong/oceanbase-all-in-one/obd/usr/bin/obd cluster start perf --wait --component oceanbase-ce,obproxy-ce,obagent ExecStop=/home/haihong/oceanbase-all-in-one/obd/usr/bin/obd cluster stop perf ExecReload=/home/haihong/oceanbase-all-in-one/obd/usr/bin/obd cluster restart perf # 重启策略 Restart=on-failure RestartSec=5s # 允许服务进程创建子进程(OBD 启动集群会生成子进程) KillMode=process LimitNOFILE=65535 LimitNPROC=65535 ##------------以下是参考----------------## ## 运行用户(必须是安装 OceanBase 的用户,通常是 root 或你创建的 ob 用户) #User=root ## 运行组 #Group=root ## 工作目录(OBD 配置文件所在目录,默认是 ~/.obd,若用 root 则为 /root/.obd) #WorkingDirectory=/root/.obd ## 启动命令(perf 是你的集群名,需替换为实际集群名) #ExecStart=/usr/bin/obd start perf ## 停止命令 #ExecStop=/usr/bin/obd stop perf ## 重启策略(异常退出时自动重启) #Restart=on-failure #RestartSec=5s ## 环境变量(确保 OBD 命令能被找到,若 obd 不在 /usr/bin 可通过 which obd 查看路径) #Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin" [Install] WantedBy=multi-user.target
刷新服务配置:
systemctl daemon-reload
设置服务自动启动:
systemctl enable oceanbase
查看服务实时日志:
journalctl -u oceanbase.service -f
7,修改配置,删除没用的grafana:
这一步需要在安装之前。
# 编辑 perf 集群的内置配置 obd cluster edit-config perf #删除配置中的 prometheus、grafana 块。 :w保存,:q退出 #再执行 obd cluster deploy perf obd cluster start perf
其他常用命令:
卸载:obd cluster destroy perf
# 编辑 perf 集群的内置配置 obd cluster edit-config perf

浙公网安备 33010602011771号