• OceanBase数据库简单安装部署——筑梦之路


    环境说明:

    操作系统:CentOS 7

    官方文档:

    OceanBase 社区

    参考资料:

    基于CentOS系统安装OceanBase数据库 - 简书

    1. # 添加yum源
    2. sudo yum install -y yum-utils
    3. sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
    4. sudo yum install -y ob-deploy
    5. # 修改配置文件
    6. ## 配置示例文件
    7. https://gitee.com/oceanbase/oceanbase/raw/master/tools/quick_start/quick_start_demo.yaml
    8. ## 配置数据库工作目录
    9. oceanbase-ce:
    10. global:
    11. # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
    12. home_path: /home/observer
    13. home_path 是 OceanBase 数据库的工作目录,OceanBase 数据库在此目录下启动
    14. # 部署并启动 OceanBase 数据库
    15. ## 部署集群
    16. obd cluster autodeploy obtest -c quick_start_demo.yaml -A
    17. 其中,obtest 为集群名称,这里只是示例,您可自行定义集群名称。一个集群只能有一个名称,且集群名称不能重复。增加 -A 参数后,将自动用系统剩余资源创建 test 租户
    18. 命令详细参考:https://open.oceanbase.com/docs/obd-cn/V1.3.3/10000000000182177
    19. ## 查看集群状态
    20. obd cluster display obtest
    21. 命令详细参考:https://open.oceanbase.com/docs/obd-cn/V1.3.3/10000000000182177
    22. # 连接数据库
    23. ## 安装客户端
    24. sudo yum install -y obclient
    25. ## 连接数据库
    26. obclient -h127.0.0.1 -P2881 -uroot@test
    27. OBClient 默认使用端口 2881 来连接 OBServer,如果您对端口做了更改,此处使用您实际的端口号。tenant_name 为您将要连接的租户名
    28. ## 检查租户信息
    29. MySQL [(none)]> use oceanbase;
    30. Reading table information for completion of table and column names
    31. You can turn off this feature to get a quicker startup with -A
    32. Database changed
    33. MySQL [oceanbase]> select * from gv$tenant;

     Docker部署OceanBase数据库

    1. 机器的资源至少可以运行 2 核 8GB 以上的 Docker 容器
    2. # 根据当前容器部署最大规格的实例
    3. docker run -p 2881:2881 --name obstandalone -d oceanbase/oceanbase-ce
    4. ## 部署 mini 的独立实例
    5. docker run -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d oceanbase/oceanbase-ce
    6. 说明
    7. 上述命令默认拉取最新版本,可根据实际需求在 Docker 镜像 中选择版本。
    8. 启动预计需要 2-5 分钟。执行以下命令,如果返回 boot success!,则启动成功。
    9. $ docker logs obstandalone | tail -1
    10. boot success!
    11. # 连接数据库
    12. oceanbase-ce 镜像安装了 OceanBase 数据库客户端 OBClient,并提供了默认连接脚本 ob-mysql
    13. docker exec -it obstandalone ob-mysql sys # 连接 sys 租户的 root 用户
    14. docker exec -it obstandalone ob-mysql root # 连接 test 租户的 root 用户
    15. docker exec -it obstandalone ob-mysql test # 连接 test 租户的 test 用户
    16. 本机OBClient 或者 MySQL 客户端连接
    17. mysql -uroot -h127.1 -P2881
    18. 连接成功后,终端将显示如下内容:
    19. $ docker exec -it obstandalone ob-mysql sys
    20. login as root@sys
    21. Command is: obclient -h127.1 -uroot@sys -A -Doceanbase -P2881
    22. Welcome to the OceanBase. Commands end with ; or \g.
    23. Your MySQL connection id is 3221487638
    24. Server version: 5.7.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22)
    25. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    26. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    27. MySQL [oceanbase]>

    生产环境部署:OceanBase 社区

    1. 帮助信息
    2. # obd -h
    3. Usage: obd <command> [options]
    4. Available commands:
    5. cluster Deploy and manage a cluster.
    6. mirror Manage a component repository for OBD.
    7. repo Manage local repository for OBD.
    8. test Run test for a running deployment.
    9. update Update OBD.
    10. Options:
    11. --version show program's version number and exit
    12. -h, --help Show help and exit.
    13. -v, --verbose Activate verbose output.
    14. # 查看obd管理的集群列表
    15. obd cluster list

    sysbench对oceanbase基准性能测试:Sysbench对OceanBase开源版3.1.3数据库的OLTP性能测试_shunwahma的博客-CSDN博客

  • 相关阅读:
    Nginx内置变量详解
    pcb电路板常见的用途有哪些?
    一文掌握 Java8 Stream 中 Collectors 的 24 个操作
    快速构建基本的SpringCloud微服务
    wireshark图形界面介绍
    02Linux各目录及每个目录的详细介绍
    Yarn重启applications记录恢复
    docker使用Open Policy Agent(OPA)进行访问控制
    Python编程基础:实验6——函数的递归
    C语言数据结构 —— 复杂度
  • 原文地址:https://blog.csdn.net/qq_34777982/article/details/126294630