一、部署概述 1.官方建议使用CentOS 6 或 CentOS 7,部署脚本只在这两个发行版上试验过。 2.资源要求 资源 描述 内存要求 至少为 OBServer 配置 8G 内存。 磁盘要求 需要为 OBServer 准备一个工
1.官方建议使用CentOS 6 或 CentOS 7,部署脚本只在这两个发行版上试验过。
2.资源要求
资源
描述
内存要求
至少为 OBServer 配置 8G 内存。
磁盘要求
需要为 OBServer 准备一个工作目录,这个目录所在的磁盘至少要有 20G 的剩余空间,并且磁盘使用率要低于 80%。
3.软件要求
软件
版本
Python
Python 2.7 及以上
二、部署前准备部署一台8G内存,50G磁盘空间,单网卡(hostonly模式)的centos7的服务器。
1.前期配置
--查看内核 [root@octa ~]# uname -a Linux octa 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@octa ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) --查看内存 [root@octa ~]# free -m total used free shared buff/cache available Mem: 7886 134 7643 8 109 7556 Swap: 5119 0 5119 --设置主机名 hostnamectl set-hostname obca --关闭防火墙 systemctl stop firewalld systemctl disable firewalld --关闭selinux vi /etc/selinux/config disabled --配置网络 nmcli con mod ens0p3 ipv4.address 192.168.56.100/24 ipv4.method manual autoconnect yes --新建目录 mkdir /soft mkdir /ob2.下载试用版oceanbase安装包
在 OceanBase 官网顶部导航栏,选择 资源 > 下载, 进入资源下载页面。
单击 安装包下载,系统会跳转到 OceanBase 社区登录页面。
输入您的用户名和密码,进行登录。
如果您还未注册 OceanBase 社区账号,请按照提示完成注册,并登录。
在弹出的对话框中,勾选 我已阅读并遵守《OceanBase 软件试用许可协议》,然后单击 下载安装包。
OceanBase 试用版的安装介质开始下载,下载的安装介质中包含部署脚本(ob-deploy.tar)。
1.解压安装包
[root@octa soft]# cd /soft/ [root@octa soft]# tar -xvf ob-deploy.tar [root@octa soft]# ls ob-deploy ob-deploy.tar2.修改默认配置
[root@octa soft]# cd ob-deploy [root@octa ob-deploy]# ls admin config.py features.md init.sql install mysql plugin_dir tools b deploy.dockerfile h init_user_oracle.sql lib mysql_example README.md bin etc hap.py init_user.sql Makefile oracle_example sysbench --配置observer启动目录home = '/ob' [root@octa ob-deploy]# vi config.py [root@octa ob-deploy]# cat config.py load('obi,obt-patch,mini-mode,sample-db,sysbench') if not indocker(): home = '/ob' obs_cfg.update(mini_mode_cfg) obs_cfg.update(system_memory='5G', memory_limit='8G', datafile_size='10G') # 定义一个单server的ob集群,mysql端口号2881,rpc端口号2882 ob1 = OBI('127.0.0.1:2882:2881') # 定义另一个单server的ob集群,mysql端口号/rpc端口号由uid hash生成 ob2 = OBI('127.0.0.1') # 单个机器上起3个observer ob3 = OBI('127.0.0.1@[z1,z2,z3]', dev='lo', is_local=True)3.初始化 OceanBase 实例(整个初始化过程大概需要一分钟时间)
[root@octa ob-deploy]# ./hap.py ob1.reboot 2021-02-26 22:19:26.454790 call.py:3 CALL: top make_local_etc_dir 2021-02-26 22:19:26.468489 call.py:3 CALL: top ob1.reboot 2021-02-26 22:19:26.471535 call.py:3 CALL: top.ob1 local_reboot 2021-02-26 22:19:26.475062 call.py:3 CALL: top.ob1 force_stop 2021-02-26 22:19:26.478799 call.py:3 CALL: top.ob1 stop 2021-02-26 22:19:26.482765 call.py:3 CALL: top.ob1 all_server 2021-02-26 22:19:26.489389 call.py:3 CALL: top.ob1.obs0 stop 2021-02-26 22:19:26.498137 magic_ctrl.py:3 retry_loop: retryloop: timeout=10 interval = 0.1 2021-02-26 22:19:26.507174 magic_ctrl.py:6 retry_loop: #### tryloop try_stop #### 2021-02-26 22:19:26.514685 call.py:3 CALL: top.ob1.obs0 try_stop 2021-02-26 22:19:26.551222 magic_ctrl.py:9 retry_loop: #### tryloop success #### 2021-02-26 22:19:26.561633 call.py:3 CALL: top.ob1 sleep 2021-02-26 22:19:26.581256 misc-deps.py:34 sleep: sleep 3 2021-02-26 22:19:29.591045 call.py:3 CALL: top.ob1 cleanup 2021-02-26 22:19:29.595084 call.py:3 CALL: top.ob1 all_server 2021-02-26 22:19:29.599943 call.py:3 CALL: top.ob1.obs0 rmdir 2021-02-26 22:19:29.613990 call.py:3 CALL: top.ob1 mk_local_dir 2021-02-26 22:19:29.621781 call.py:3 CALL: top.ob1 mkdir 2021-02-26 22:19:29.626262 call.py:3 CALL: top.ob1 all_server 2021-02-26 22:19:29.631620 call.py:3 CALL: top.ob1.obs0 mkdir 2021-02-26 22:19:29.671123 call.py:3 CALL: top.ob1 local_sync 2021-02-26 22:19:29.676008 call.py:3 CALL: top.ob1 all_server 2021-02-26 22:19:29.681570 call.py:3 CALL: top.ob1.obs0 local_sync 2021-02-26 22:19:30.411532 call.py:3 CALL: top.ob1 prepare_proxy_cfg 2021-02-26 22:19:30.414379 call.py:3 CALL: top.ob1 start_servers 2021-02-26 22:19:30.419056 call.py:3 CALL: top.ob1 all_observer 2021-02-26 22:19:30.424605 call.py:3 CALL: top.ob1.obs0 start /ob/ob1.obs0/bin/observer -P 2882 -p 2881 -z test -n ob1.root -c 1 -d /ob/ob1.obs0/store -l INFO -i lo -r 127.0.0.1:2882:2881 -o memory_limit=8G,cache_wash_threshold=1G,row_purge_thread_count=1,net_thread_count=1,enable_syslog_recycle=True,enable_merge_by_turn=FALSE,cpu_count=16,location_refresh_thread_count=2,max_syslog_file_count=3,major_freeze_duty_time=Disable,__easy_memory_limit=1G,schema_history_expire_time=1d,merge_thread_count=1,writing_throttling_trigger_percentage=70,_max_trx_size=2M,workers_per_cpu_quota=2,enable_separate_sys_clog=0,datafile_disk_percentage=50,__min_full_resource_pool_memory=536870912,system_memory=5G,memory_chunk_cache_size=128M,trace_log_slow_query_watermark=10s,writing_throttling_maximum_duration=1m,switchover_process_thread_count=1,datafile_size=10G,minor_freeze_times=500,stack_size=1536K,disk_io_thread_coun=1 rpc port: 2882 mysql port: 2881 zone: test appname: ob1.root cluster id: 1 data_dir: /ob/ob1.obs0/store log level: INFO devname: lo rs list: 127.0.0.1:2882:2881 optstr: memory_limit=8G,cache_wash_threshold=1G,row_purge_thread_count=1,net_thread_count=1,enable_syslog_recycle=True,enable_merge_by_turn=FALSE,cpu_count=16,location_refresh_thread_count=2,max_syslog_file_count=3,major_freeze_duty_time=Disable,__easy_memory_limit=1G,schema_history_expire_time=1d,merge_thread_count=1,writing_throttling_trigger_percentage=70,_max_trx_size=2M,workers_per_cpu_quota=2,enable_separate_sys_clog=0,datafile_disk_percentage=50,__min_full_resource_pool_memory=536870912,system_memory=5G,memory_chunk_cache_size=128M,trace_log_slow_query_watermark=10s,writing_throttling_maximum_duration=1m,switchover_process_thread_count=1,datafile_size=10G,minor_freeze_times=500,stack_size=1536K,disk_io_thread_coun=1 2021-02-26 22:19:30.518636 call.py:3 CALL: top.ob1 bootstrap 2021-02-26 22:19:30.524717 magic_ctrl.py:3 retry_loop: retryloop: timeout=864000 interval = 1 2021-02-26 22:19:30.528981 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap #### 2021-02-26 22:19:30.533487 call.py:3 CALL: top.ob1 obs0.bootstrap ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) 2021-02-26 22:19:30.624556 magic_ctrl.py:12 retry_loop: tryloop fail: Fail: shell fail: ./mysql --prompt "OceanBase(\u@\d)>" -h 127.0.0.1 -P 2881 -uroot input="alter system bootstrap REGION 'sys_region' ZONE 'test' SERVER '127.0.0.1:2882'; # ExceptionOnFail DiscardXOutput" ret=1 2021-02-26 22:19:31.633175 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap #### 2021-02-26 22:19:31.637507 call.py:3 CALL: top.ob1 obs0.bootstrap ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) 2021-02-26 22:19:31.694000 magic_ctrl.py:12 retry_loop: tryloop fail: Fail: shell fail: ./mysql --prompt "OceanBase(\u@\d)>" -h 127.0.0.1 -P 2881 -uroot input="alter system bootstrap REGION 'sys_region' ZONE 'test' SERVER '127.0.0.1:2882'; # ExceptionOnFail DiscardXOutput" ret=1 2021-02-26 22:19:32.700971 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap #### 2021-02-26 22:19:32.705280 call.py:3 CALL: top.ob1 obs0.bootstrap ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) 2021-02-26 22:19:32.807480 magic_ctrl.py:12 retry_loop: tryloop fail: Fail: shell fail: ./mysql --prompt "OceanBase(\u@\d)>" -h 127.0.0.1 -P 2881 -uroot input="alter system bootstrap REGION 'sys_region' ZONE 'test' SERVER '127.0.0.1:2882'; # ExceptionOnFail DiscardXOutput" ret=1 2021-02-26 22:19:33.812714 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap #### 2021-02-26 22:19:33.817042 call.py:3 CALL: top.ob1 obs0.bootstrap 2021-02-26 22:20:45.174806 magic_ctrl.py:9 retry_loop: #### tryloop success #### 2021-02-26 22:20:45.179920 call.py:3 CALL: top.ob1 post_bootstrap 2021-02-26 22:20:45.184520 call.py:3 CALL: top.ob1 wait_service 2021-02-26 22:20:45.199348 magic_ctrl.py:3 retry_loop: retryloop: timeout=864000 interval = 1 2021-02-26 22:20:45.203777 magic_ctrl.py:6 retry_loop: #### tryloop obs0.wait_service #### 2021-02-26 22:20:45.362713 call.py:3 CALL: top.ob1 obs0.wait_service 2021-02-26 22:20:45.613934 magic_ctrl.py:9 retry_loop: #### tryloop success #### 2021-02-26 22:20:45.618807 call.py:3 CALL: top.ob1 exec_init_sql 2021-02-26 22:20:45.622290 call.py:3 CALL: top.ob1 obs0.sql 2021-02-26 22:21:05.838187 call.py:3 CALL: top.ob1 add_server 2021-02-26 22:21:05.842090 call.py:3 CALL: top.ob1 all_obs 2021-02-26 22:21:05.847035 call.py:3 CALL: top.ob1 exec_init_user_sql1 2021-02-26 22:21:05.941993 call.py:3 CALL: top.ob1 exec_init_user_sql2 2021-02-26 22:21:05.945515 call.py:3 CALL: top.ob1 obs0.mysql 2021-02-26 22:21:06.904660 call.py:3 CALL: top.ob1 start_proxy 2021-02-26 22:21:06.909666 call.py:3 CALL: top.ob1 all_proxy 2021-02-26 22:21:06.914466 call.py:3 CALL: top.ob1 check_bootstrap 2021-02-26 22:21:06.943952 call.py:3 CALL: top.ob1 obs0.check_bootstrap [('force_stop', [('obs0.stop', 'succ')]), ('sleep', None), ('cleanup', [('obs0.rmdir', 0)]), ('mk_local_dir', 0), ('mkdir', [('obs0.mkdir', 0)]), ('local_sync', [('obs0.local_sync', 0)]), ('prepare_proxy_cfg', 'skip'), ('start_servers', [('obs0.start', 0)]), ('bootstrap', 'succ'), ('post_bootstrap', None), ('wait_service', 'succ'), ('exec_init_sql', 0), ('add_server', []), ('exec_init_user_sql1', 'skip'), ('exec_init_user_sql2', 0), ('start_proxy', []), ('check_bootstrap', 0)] 初始化 OceanBase 实例成功之后,会自动创建两个租户,sys 租户和一个普通的 mysql 租户。4.部署后验证
--通过 MySQL 客户端连接 OceanBase 数据库 [root@octa ob-deploy]# ./hap.py ob1.obmysql 2021-02-26 22:22:56.870359 call.py:3 CALL: top make_local_etc_dir 2021-02-26 22:22:56.884471 call.py:3 CALL: top ob1.obmysql 2021-02-26 22:22:56.886940 call.py:3 CALL: top.ob1 sql 2021-02-26 22:22:56.889862 call.py:3 CALL: top.ob1 obs0.sql 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 MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221488235 Server version: 5.7.25 OceanBase 2.2.50 (r1-1c6441e8fb858c80da395f934f67ed305425864e) (Built Mar 6 2020 18:41:01) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. OceanBase(root@oceanbase)>show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | SYS | | LBACSYS | | ORAAUDITOR | | test | +--------------------+ 7 rows in set (0.00 sec) OceanBase(root@oceanbase)>use oceanbase; Database changed OceanBase(root@oceanbase)>show tables; +-----------------------------------------+ | Tables_in_oceanbase | +-----------------------------------------+ | __all_acquired_snapshot | | __all_backup_clean_info_history | | __all_backup_log_archive_status_history | | __all_backup_task_clean_history | | __all_backup_task_history | | __all_build_index_param | | __all_charset | | __all_clog_history_info | | __all_clog_history_info_v2 | | __all_cluster | | __all_coll_type | | __all_coll_type_history | | __all_collation | | __all_column | | __all_column_history | | __all_column_stat | | __all_column_statistic | | __all_constraint | | __all_constraint_history | | __all_core_table | | __all_database | | __all_database_history | | __all_database_privilege | | __all_database_privilege_history | | __all_dblink | | __all_dblink_history | | __all_ddl_helper | | __all_ddl_id | | __all_ddl_operation | | __all_def_sub_part | | __all_def_sub_part_history | | __all_dummy | | __all_election_event_history | | __all_failover_info | | __all_failover_scn | | __all_foreign_key | | __all_foreign_key_column | | __all_foreign_key_column_history | | __all_foreign_key_history | | __all_freeze_schema_version | | __all_frozen_map | | __all_func | | __all_func_history | | __all_global_index_data_src | | __all_gts | | __all_histogram_stat | | __all_immediate_effect_index_sstable | | __all_index_build_stat | | __all_index_checksum | | __all_index_schedule_task | | __all_index_wait_transaction_status | | __all_local_index_status | | __all_meta_table | | __all_ori_schema_version | | __all_outline | | __all_outline_history | | __all_package | | __all_package_history | | __all_part | | __all_part_history | | __all_part_info | | __all_part_info_history | | __all_partition_member_list | | __all_plan_baseline | | __all_plan_baseline_history | | __all_privilege | | __all_recyclebin | | __all_resource_pool | | __all_restore_info | | __all_restore_job | | __all_restore_job_history | | __all_restore_task | | __all_root_table | | __all_rootservice_event_history | | __all_rootservice_job | | __all_routine | | __all_routine_history | | __all_routine_param | | __all_routine_param_history | | __all_seed_parameter | | __all_sequence | | __all_sequence_object | | __all_sequence_object_history | | __all_sequence_v2 | | __all_sequence_value | | __all_server | | __all_server_event_history | | __all_sql_execute_task | | __all_sstable_checksum | | __all_sstable_column_checksum | | __all_sub_part | | __all_sub_part_history | | __all_synonym | | __all_synonym_history | | __all_sys_parameter | | __all_sys_stat | | __all_sys_variable | | __all_sys_variable_history | | __all_table | | __all_table_history | | __all_table_privilege | | __all_table_privilege_history | | __all_table_stat | | __all_tablegroup | | __all_tablegroup_history | | __all_temp_table | | __all_tenant | | __all_tenant_backup_clean_info | | __all_tenant_backup_info | | __all_tenant_backup_log_archive_status | | __all_tenant_backup_task | | __all_tenant_gc_partition_info | | __all_tenant_gts | | __all_tenant_history | | __all_tenant_keystore | | __all_tenant_keystore_history | | __all_tenant_meta_table | | __all_tenant_ols_component | | __all_tenant_ols_component_history | | __all_tenant_ols_label | | __all_tenant_ols_label_history | | __all_tenant_ols_policy | | __all_tenant_ols_policy_history | | __all_tenant_ols_user_level | | __all_tenant_ols_user_level_history | | __all_tenant_partition_meta_table | | __all_tenant_pg_backup_task | | __all_tenant_plan_baseline | | __all_tenant_plan_baseline_history | | __all_tenant_profile | | __all_tenant_profile_history | | __all_tenant_resource_usage | | __all_tenant_role_grantee_map | | __all_tenant_role_grantee_map_history | | __all_tenant_security_audit | | __all_tenant_security_audit_history | | __all_tenant_security_audit_record | | __all_tenant_sstable_column_checksum | | __all_tenant_tablespace | | __all_tenant_tablespace_history | | __all_tenant_trigger | | __all_tenant_trigger_history | | __all_tenant_user_failed_login_stat | | __all_time_zone | | __all_time_zone_name | | __all_time_zone_transition | | __all_time_zone_transition_type | | __all_type | | __all_type_attr | | __all_type_attr_history | | __all_type_history | | __all_unit | | __all_unit_config | | __all_unit_load_history | | __all_user | | __all_user_history | | __all_weak_read_service | | __all_zone | | __tenant_parameter | | gv$concurrent_limit_sql | | gv$database | | gv$latch | | gv$lock_wait_stat | | gv$memory | | gv$memstore | | gv$memstore_info | | gv$minor_merge_info | | gv$ob_sql_workarea_memory_info | | gv$obrpc_incoming | | gv$obrpc_outgoing | | gv$outline | | gv$partition | | gv$partition_audit | | gv$plan_cache_plan_explain | | gv$plan_cache_plan_stat | | gv$plan_cache_reference_info | | gv$plan_cache_stat | | gv$ps_item_info | | gv$ps_stat | | gv$server_memstore | | gv$session_event | | gv$session_longops | | gv$session_wait | | gv$session_wait_history | | gv$sesstat | | gv$sql | | gv$sql_audit | | gv$sql_monitor | | gv$sql_plan_monitor | | gv$sql_plan_statistics | | gv$sql_workarea | | gv$sql_workarea_active | | gv$sql_workarea_histogram | | gv$sysstat | | gv$system_event | | gv$table | | gv$tenant | | gv$tenant_memstore_allocator_info | | gv$tenant_px_worker_stat | | gv$tenant_sequence_object | | gv$unit | | gv$unit_load_balance_event_history | | v$event_name | | v$latch | | v$lock_wait_stat | | v$memory | | v$memstore | | v$memstore_info | | v$minor_merge_info | | v$ob_backup_archivelog_process | | v$ob_backup_archivelog_summary | | v$ob_backup_job_details | | v$ob_backup_process | | v$ob_backup_set_details | | v$ob_backup_set_expired | | v$ob_cluster | | v$ob_cluster_event_history | | v$ob_cluster_stats | | v$ob_sql_workarea_memory_info | | v$ob_standby_status | | v$ob_timestamp_service | | v$obrpc_incoming | | v$obrpc_outgoing | | v$partition | | v$partition_audit | | v$plan_cache_plan_explain | | v$plan_cache_plan_stat | | v$plan_cache_reference_info | | v$plan_cache_stat | | v$ps_item_info | | v$ps_stat | | v$session_event | | v$session_longops | | v$session_wait | | v$session_wait_history | | v$sesstat | | v$sql | | v$sql_audit | | v$sql_monitor | | v$sql_plan_monitor | | v$sql_plan_statistics | | v$sql_workarea | | v$sql_workarea_active | | v$sql_workarea_histogram | | v$statname | | v$sysstat | | v$system_event | | v$tenant_memstore_allocator_info | | v$tenant_px_worker_stat | | v$unit | +-----------------------------------------+ 250 rows in set (0.00 sec)