Oceadatabase管理-数据库简易部署

–安装 mysql客户端

[root@localhost ~]# rpm -qa|grep mysql

qt-mysql-4.8.7-2.el7.x86_64
akonadi-mysql-1.9.2-4.el7.x86_64

[root@localhost ~]# rpm -qa|grep mariadb

mariadb-5.5.56-2.el7.x86_64
mariadb-libs-5.5.56-2.el7.x86_64
mariadb-server-5.5.56-2.el7.x86_64

[root@localhost ~]# rpm -e mysql

error: package mysql is not installed

[root@localhost ~]# rpm -e --nodeps qt-mysql-4.8.7-2.el7.x86_64
[root@localhost ~]# rpm -e --nodeps akonadi-mysql-1.9.2-4.el7.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-5.5.56-2.el7.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

/sbin/ldconfig: /lib64/libcrypto.so.1.0.0 is not a symbolic link

/sbin/ldconfig: /lib64/libssl.so.1.0.0 is not a symbolic link

[root@localhost ~]# rpm -e --nodeps mariadb-server-5.5.56-2.el7.x86_64

[root@localhost ~]#

[root@localhost ~]# mkdir /usr/local/mysql
[root@localhost patrol]# mv mysql-5.7.29-linux-glibc2.12-x86_64.tar /usr/local/mysql/
[root@localhost mysql]# tar -xvf mysql-5.7.29-linux-glibc2.12-x86_64.tar
[root@localhost mysql]# tar -xvf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz
[root@localhost mysql]# mv mysql-5.7.29-linux-glibc2.12-x86_64/* /usr/local/mysql/
[root@localhost local]# chown mysql:mysql mysql/
[root@localhost local]# chmod 775 mysql
[root@localhost local]#
[root@localhost mysql]# chown -R mysql:mysql *
[root@localhost mysql]# chmod -R 775 *

[root@localhost mysql]# echo “export PATH=$PATH:/usr/local/mysql/bin”>>/etc/profile
[root@localhost mysql]# sourct /etc/profile

[root@localhost ~]# mysqld --initialize --user=mysql
mysqld: Can’t change dir to ‘/usr/local/mysql/data/’ (Errcode: 13 - Permission denied)
2020-10-14T06:16:58.734152Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-10-14T06:16:58.737602Z 0 [ERROR] failed to set datadir to /usr/local/mysql/data/
2020-10-14T06:16:58.737626Z 0 [ERROR] Aborting

[root@localhost ~]# mysqld --initialize --user=mysql --explicit_defaults_for_timestamp
mysqld: Can’t change dir to ‘/usr/local/mysql/data/’ (Errcode: 13 - Permission denied)
2020-10-14T06:17:09.082052Z 0 [ERROR] failed to set datadir to /usr/local/mysql/data/
2020-10-14T06:17:09.082110Z 0 [ERROR] Aborting

[root@localhost local]# mysqld --initialize --user=mysql --explicit_defaults_for_timestamp
2020-10-14T06:19:17.048887Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-10-14T06:19:17.120919Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-10-14T06:19:17.180295Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 302c22a7-0de5-11eb-a7c6-005056aef032.
2020-10-14T06:19:17.181447Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2020-10-14T06:19:19.450442Z 0 [Warning] CA certificate ca.pem is self signed.
2020-10-14T06:19:19.605371Z 1 [Note] A temporary password is generated for root@localhost: ZQAMi&jKI3u2

[root@localhost local]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost local]# chmod +x /etc/init.d/mysqld

[root@localhost local]# mysql -uroot -hlocalhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.29

Copyright © 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>
mysql>
mysql>
mysql> alter user ‘root’@‘localhost’ identified by “ora#123”;

mysql> create user ‘clg’@’%’ identified by “ora#123”;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on . to ‘clg’@’%’;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> select @@version
-> ;
±----------+
| @@version |
±----------+
| 5.7.29 |
±----------+
1 row in set (0.00 sec)

—安装oceadatabase数据库

[root@localhost local]# mkdir /ob
[root@localhost local]# chmod 775 /ob
[root@localhost ob]# chown root:root mini-ob-deploy.tar
[root@localhost ob]# chmod 775 mini-ob-deploy.tar
[root@localhost ob]# cd mini-ob-deploy/

[root@localhost mini-ob-deploy]# ./hap.py ob1.reboot
2020-10-14 14:27:37.766495 call.py:3 CALL: top make_local_etc_dir
2020-10-14 14:27:37.780876 call.py:3 CALL: top ob1.reboot
2020-10-14 14:27:37.783866 call.py:3 CALL: top.ob1 local_reboot
2020-10-14 14:27:37.788031 call.py:3 CALL: top.ob1 force_stop
2020-10-14 14:27:37.792658 call.py:3 CALL: top.ob1 stop
2020-10-14 14:27:37.798407 call.py:3 CALL: top.ob1 all_server
2020-10-14 14:27:37.806039 call.py:3 CALL: top.ob1.obs0 stop
2020-10-14 14:27:37.812905 magic_ctrl.py:3 retry_loop: retryloop: timeout=10 interval = 0.1
2020-10-14 14:27:37.820642 magic_ctrl.py:6 retry_loop: #### tryloop try_stop ####
2020-10-14 14:27:37.828508 call.py:3 CALL: top.ob1.obs0 try_stop
2020-10-14 14:27:37.904067 magic_ctrl.py:9 retry_loop: #### tryloop success ####
2020-10-14 14:27:37.912141 call.py:3 CALL: top.ob1 sleep
2020-10-14 14:27:37.916860 misc-deps.py:34 sleep: sleep 3
2020-10-14 14:27:40.924948 call.py:3 CALL: top.ob1 cleanup
2020-10-14 14:27:40.929683 call.py:3 CALL: top.ob1 all_server
2020-10-14 14:27:40.936355 call.py:3 CALL: top.ob1.obs0 rmdir
2020-10-14 14:27:40.948645 call.py:3 CALL: top.ob1 mk_local_dir
2020-10-14 14:27:40.957556 call.py:3 CALL: top.ob1 mkdir
2020-10-14 14:27:40.962632 call.py:3 CALL: top.ob1 all_server
2020-10-14 14:27:40.969181 call.py:3 CALL: top.ob1.obs0 mkdir
2020-10-14 14:27:40.996572 call.py:3 CALL: top.ob1 local_sync
2020-10-14 14:27:41.001707 call.py:3 CALL: top.ob1 all_server
2020-10-14 14:27:41.008368 call.py:3 CALL: top.ob1.obs0 local_sync
2020-10-14 14:27:41.181213 call.py:3 CALL: top.ob1 prepare_proxy_cfg
2020-10-14 14:27:41.186361 call.py:3 CALL: top.ob1 start_servers
2020-10-14 14:27:41.191038 call.py:3 CALL: top.ob1 all_observer
2020-10-14 14:27:41.197684 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
[2020-10-14 14:27:41.271171] ERROR [LIB] pidfile_test (utility.cpp:1168) [9451][0][Y0-0000000000000000] [lt=0] fid file doesn’t exist(pidfile=“run/observer.pid”) BACKTRACE:0x7a794ba 0x7a24476 0x461333 0x434cf82 0x7a7d09c 0x4499979 0x7fc817d0b445 0x44f8385
2020-10-14 14:27:41.273614 call.py:3 CALL: top.ob1 bootstrap
2020-10-14 14:27:41.278937 magic_ctrl.py:3 retry_loop: retryloop: timeout=864000 interval = 1
2020-10-14 14:27:41.284572 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap ####
2020-10-14 14:27:41.290156 call.py:3 CALL: top.ob1 obs0.bootstrap
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
2020-10-14 14:27:41.306129 magic_ctrl.py:12 retry_loop: tryloop fail: Fail: shell fail: /usr/local/mysql/bin/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
2020-10-14 14:27:42.312819 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap ####
2020-10-14 14:27:42.318772 call.py:3 CALL: top.ob1 obs0.bootstrap
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
2020-10-14 14:27:42.335496 magic_ctrl.py:12 retry_loop: tryloop fail: Fail: shell fail: /usr/local/mysql/bin/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
2020-10-14 14:27:43.342476 magic_ctrl.py:6 retry_loop: #### tryloop obs0.bootstrap ####
2020-10-14 14:27:43.348355 call.py:3 CALL: top.ob1 obs0.bootstrap

2020-10-14 14:28:07.058458 magic_ctrl.py:9 retry_loop: #### tryloop success ####
2020-10-14 14:28:07.065302 call.py:3 CALL: top.ob1 post_bootstrap
2020-10-14 14:28:07.070329 call.py:3 CALL: top.ob1 wait_service
2020-10-14 14:28:07.074972 magic_ctrl.py:3 retry_loop: retryloop: timeout=864000 interval = 1
2020-10-14 14:28:07.080661 magic_ctrl.py:6 retry_loop: #### tryloop obs0.wait_service ####
2020-10-14 14:28:07.086320 call.py:3 CALL: top.ob1 obs0.wait_service
2020-10-14 14:28:07.121056 magic_ctrl.py:9 retry_loop: #### tryloop success ####
2020-10-14 14:28:07.127126 call.py:3 CALL: top.ob1 exec_init_sql
2020-10-14 14:28:07.132505 call.py:3 CALL: top.ob1 obs0.sql
2020-10-14 14:28:19.875361 call.py:3 CALL: top.ob1 add_server
2020-10-14 14:28:19.880574 call.py:3 CALL: top.ob1 all_obs
2020-10-14 14:28:19.887585 call.py:3 CALL: top.ob1 exec_init_user_sql1
2020-10-14 14:28:19.892147 call.py:3 CALL: top.ob1 exec_init_user_sql2
2020-10-14 14:28:19.897031 call.py:3 CALL: top.ob1 obs0.mysql
2020-10-14 14:28:20.056553 call.py:3 CALL: top.ob1 start_proxy
2020-10-14 14:28:20.062041 call.py:3 CALL: top.ob1 all_proxy
2020-10-14 14:28:20.079272 call.py:3 CALL: top.ob1 check_bootstrap
2020-10-14 14:28:20.083986 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)]
[root@localhost mini-ob-deploy]#
[root@localhost mini-ob-deploy]#
[root@localhost mini-ob-deploy]# mysql -uroot -pora#123 -hlocalhost
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.29 MySQL Community Server (GPL)

Copyright © 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
±-------------------+
4 rows in set (0.00 sec)

mysql>

[root@localhost ~]# /etc/init.d/mysqld stop
Shutting down MySQL… SUCCESS!
[root@localhost ~]# cd /ob/mini-ob-deploy/

[root@localhost mini-ob-deploy]# ./hap.py ob1.obmysql

2020-10-14 14:40:26.052279 call.py:3 CALL: top make_local_etc_dir
2020-10-14 14:40:26.067326 call.py:3 CALL: top ob1.obmysql
2020-10-14 14:40:26.070556 call.py:3 CALL: top.ob1 sql
2020-10-14 14:40:26.076747 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 MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3221490446
Server version: 5.7.25 OceanBase 2.2.50 (r1-1c6441e8fb858c80da395f934f67ed305425864e) (Built Mar 6 2020 18:41:01)

Copyright © 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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)>exit

ocdb MYSQL客户端登录

./mysql -h10.2.2.1 -P2881 -uroot

猜你喜欢

转载自blog.csdn.net/oradbm/article/details/109090176