暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

OceanBase 4.0:使用all in one包安装和启动一个单机数据库

原创 听见风的声音 2023-01-16
1701

1 下载OB 4.0的all in one包

  下载地址在这里

https://open.oceanbase.com/softwareCenter/community

  打开页面点击第一个OceanBase All in One后弹出下载窗口,下载时注意点击对应CPU架构的链接。


2 将下载的包传到服务器上并解压安装

     OceanBase 4.0对操作系统及内核的版本都有要求,如果是centos,要求本为7.x,内核3.10.0 版本及以上,检查一下操作系统及内核版本。

[root@my_ob ~]# uname -a
  Linux my_ob 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@my_ob ~]# cat /etc/redhat-release
  CentOS Linux release 7.9.2009 (Core)


    下载的安装包上传到/root目录下,解压到/usr/local目录下

[root@my_ob ~]# ls -l oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
  -rw-r--r-- 1 root root 257703079 Dec 26 09:15 oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
[root@my_ob ~]# tar -xzf oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz -C /usr/local


  切换到/usr/local/oceanbase-all-in-one/bin目录下,运行安装脚本

[root@my_ob bin]# ./install.sh
  name: grafana
  version: 7.5.17
  release:1
  arch: x86_64
  md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
  add /usr/local/oceanbase-all-in-one/rpms/grafana-7.5.17-1.el7.x86_64.rpm to local mirror
  name: obagent
  version: 1.2.0
  release:4.el7
  arch: x86_64
  md5: 0e8f5ee68c337ea28514c9f3f820ea546227fa7e
  add /usr/local/oceanbase-all-in-one/rpms/obagent-1.2.0-4.el7.x86_64.rpm to local mirror
  name: obproxy-ce
  version: 4.0.0
  release:5.el7
  arch: x86_64
  md5: de53232a951184fad75b15884458d85e31d2f6c3
  add /usr/local/oceanbase-all-in-one/rpms/obproxy-ce-4.0.0-5.el7.x86_64.rpm to local mirror
  name: oceanbase-ce
  version: 4.0.0.0
  release:100000272022110114.el7
  arch: x86_64
  md5: 42611dc51ca9bb28f36e60e4406ceea4a74914c7
  add /usr/local/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
  name: oceanbase-ce-libs
  version: 4.0.0.0
  release:100000272022110114.el7
  arch: x86_64
  md5: 188919f8128394bf9b62e3989220ded05f1d14da
  add /usr/local/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
  name: prometheus
  version: 2.37.1
  release:10000102022110211.el7
  arch: x86_64
  md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
  add /usr/local/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
  Disable remote ok
  
  #####################################################################
   Install Finished
  =====================================================================
  Setup Environment:     source ~/.oceanbase-all-in-one/bin/env.sh
  Quick Start:           obd demo
  More Details:          obd -h
  =====================================================================


可以看到脚本不仅安装了ob,obproxy,也安装了prometheus,grafana。

3 集群部署和启动

     可以使用obd demo命令快速部署和启动ob集群,不过使用这个命令部署需要50G的磁盘空间,root文件系统没有这么多剩余空间时,可以选择使用obd提供的配置文件示例来启动一个最小化的集群。

     obd的配置文件示例在/usr/local/oceanbase-all-in-one/obd/usr/obd/example目录下,拷贝目录下的mini-local-example.yaml至当前用户的home目录下,简单编辑一下,可以部署和启动集群了。

[root@my_ob ~]# obd cluster deploy lo -c mini-local-example.yaml
      install oceanbase-ce-4.0.0.0 for local ok
      +--------------------------------------------------------------------------------------------+
      |                                          Packages                                          |
      +--------------+---------+------------------------+------------------------------------------+
      | Repository   | Version | Release                | Md5                                      |
      +--------------+---------+------------------------+------------------------------------------+
      | oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 |
      +--------------+---------+------------------------+------------------------------------------+
      Repository integrity check ok
      Parameter check ok
      Open ssh connection ok
      Cluster status check ok
      Initializes observer work home ok
      Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository install ok
      Remote oceanbase-ce-4.0.0.0-100000272022110114.el7-42611dc51ca9bb28f36e60e4406ceea4a74914c7 repository lib check ok
      lo deployed
[root@my_ob ~]# obd cluster start lo
      Get local repositories ok
      Search plugins ok
      Open ssh connection ok
      Load cluster param plugin ok
      Check before start observer x
      [ERROR] (127.0.0.1): when production_mode is True, memory_limit can not be less then 16.0G
      [ERROR] (127.0.0.1) / not enough disk space. (Avail: 11.4G, Need: 20.0G)
      
      See https://www.oceanbase.com/product/ob-deployer/error-codes .


      集群部署时没有问题,启动时报错了,一个是生产模式下内存不能小于16G,另一个是空间不能小于20G,第一个问题可以将配置文件中的生产模式改为false,第二个问题则需要设置ob工作目录到较大的文件系统上。删除现有部署重新部署后启动集群。

[root@localhost ~]# obd cluster start lo
      Get local repositories ok
      Search plugins ok
      Open ssh connection ok
      Load cluster param plugin ok
      Check before start observer ok
      [WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
      [WARN] OBD-1007: (127.0.0.1) The recommended number of open files is 655350 (Current value: 65536)
      [WARN] (127.0.0.1) clog and data use the same disk (/)
      Start observer ok
      observer program health check ok
      Connect to observer ok
      Initialize cluster ok
      Wait for observer init ok
      +---------------------------------------------+
      |                   observer                  |
      +-----------+---------+------+-------+--------+
      | ip        | version | port | zone  | status |
      +-----------+---------+------+-------+--------+
      | 127.0.0.1 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
      +-----------+---------+------+-------+--------+
      obclient -h127.0.0.1 -P2881 -uroot -Doceanbase
      
      lo running


集群启动成功,可以使用obclient登录了

[root@localhost ~]# obclient -h127.0.0.1 -P2881 -uroot -Doceanbase
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A

      Welcome to the OceanBase.  Commands end with ; or \g.
      Your OceanBase connection id is 3221487617
      Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov  1 2022 14:57:18)

      Copyright (c) 2000, 2018, OB Corporation Ab and others.

      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


检查一下数据库的版本

obclient [oceanbase]> select version();
      +------------------------------+
      | version()                    |
      +------------------------------+
      | 5.7.25-OceanBase_CE-v4.0.0.0 |
      +------------------------------+
      1 row in set (0.001 sec)
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论