oceanbase demo版本部署
环境:
OS:Centos
oceabase:4.2
1.下载介质
https://www.oceanbase.com/softwarecenter
oceanbase-all-in-one-4.2.0.0-100120230821114201.el7.x86_64.tar.gz
2.解压安装
[root@host134 soft]# tar -xzf oceanbase-all-in-one-4.2.0.0-100120230821114201.el7.x86_64.tar.gz
[root@host134 soft]# cd oceanbase-all-in-one/bin
[root@host134 bin]# ./install.sh
#####################################################################
Install Finished
=====================================================================
Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh
Start Web Service: obd web
Quick Start: obd demo
More Details: obd -h
====================================================================
[root@host134 bin]# source ~/.oceanbase-all-in-one/bin/env.sh
3.社区版部署
[root@host134 bin]# which obd
/root/.oceanbase-all-in-one/obd/usr/bin/obd
[root@host134 bin]# obd demo
4.连接数据库
通过 2881 端口直连数据库
[root@host134 bin]# obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -A
通过 ODP 代理访问数据库
[root@host134 bin]# obclient -h127.0.0.1 -P2883 -uroot@sys -Doceanbase -A
5.配置密码
使用 obd demo 命令快速部署的 OceanBase 数据库默认 root@sys 用户登录密码为空,您可参考如下命令为 demo 集群配置密码。
修改配置文件
[root@host134 oceanbase]#obd cluster edit-config demo
执行上述命令打开配置文件后,在配置文件中 oceanbase-ce(社区版)/oceanbase(企业版) 组件下添加 root_password: xxxx,添加完成后保存退出。示例如下:
oceanbase-ce:
servers:
- 127.0.0.1
global:
home_path: /home/admin/oceanbase-ce
... # 省略部分配置项
log_disk_size: 13G
root_password: mysql123
保存后会有如下提升:
"/tmp/tmppgxnm6ik.yaml" 53L, 1056C written
Search param plugin and load ok
Parameter check ok
Save deploy "demo" configuration
Use `obd cluster reload demo` to make changes take effect.
Trace ID: abd00464-4581-11ee-8be2-525400c8dc1f
If you want to view detailed obd logs, please run: obd display-trace abd00464-4581-11ee-8be2-525400c8dc1f
这里需要执行obd cluster reload demo
[root@host134 oceanbase]# obd cluster reload demo
6.使用密码登录
[root@host134 oceanbase]# obclient -h 127.0.0.1 -P2881 -uroot@sys -Doceanbase -A -pmysql123
[root@host134 oceanbase]# obclient -h 127.0.0.1 -P2881 -uroot -Doceanbase -A -pmysql123
7.创建数据库(语句与mysql一样)
[root@host134 oceanbase]# obclient -h 127.0.0.1 -P2881 -uroot -A -pmysql123
obclient [(none)]>create database db_test;
建表(语句与mysql一样):
use db_test;
CREATE TABLE `tb_test02` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`name1` varchar(32) DEFAULT NULL,
`name2` varchar(32) DEFAULT NULL,
`name3` varchar(32) DEFAULT NULL,
`name4` varchar(32) DEFAULT NULL,
`name5` varchar(32) DEFAULT NULL,
`name6` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id`)
);
8.创建用户
grant all privileges on *.* to 'hxl'@'%' identified by 'mysql' WITH GRANT OPTION;
9.pyhton操作oceabase
与mysql一样的操作,引入如下包即可
import pymysql
10.维护操作
[root@host134 xtrabackup_file]# source ~/.oceanbase-all-in-one/bin/env.sh
[root@host134 xtrabackup_file]# obd cluster --help
Usage: obd cluster <command> [options]
Available commands:
autodeploy Deploy a cluster automatically by using a simple configuration file.
check4ocp Check Whether OCP Can Take Over Configurations in Use
chst Change Deployment Configuration Style
deploy Deploy a cluster by using the current deploy configuration or a deploy yaml file.
destroy Destroy a deployed cluster.
display Display the information for a cluster.
edit-config Edit the configuration file for a specific deployment.
list List all the deployments.
redeploy Redeploy a started cluster.
reinstall Reinstall a deployed component
reload Reload a started cluster.
restart Restart a started cluster.
start Start a deployed cluster.
stop Stop a started cluster.
tenant Create, drop or list a tenant.
upgrade Upgrade a cluster.
Options:
-h, --help Show help and exit.
-v, --verbose Activate verbose output.
重启集群
obd cluster stop demo
obd cluster start demo
demo为集群名称
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
2020-08-28 批量执行redis命令