分享一个交互式部署 OB 的脚本(依赖OBD)

OB 企业版发布了一个单机版软件,里面有个交互式部署OB的 SHELL 脚本,使用体验还不错(不知道是哪位大侠开发的),有兴趣的可以下载,放到软件目录 /home/admin/oceanbase-standalone-all-in-one/bin 下。应该也可以跟社区版 OBD 的部署结合使用。

交互过程如下:

[admin@server69 oceanbase-standalone-all-in-one]$ bin/install_ob.sh                                                                                              
                                                                                                                                                                 
Enter the IP (Default: 10.0.0.69) (only support local IP):                                                                                                       
 Valid local IP: 10.0.0.69                                                                                                                                       
Enter the current user password :                                                                                                                                
Trace ID: 4d0c28e6-14fa-11f0-8964-0050569daf00                                                                                                                   
If you want to view detailed obd logs, please run: obd display-trace 4d0c28e6-14fa-11f0-8964-0050569daf00                                                        
get system config ok                                                                                                                                             
+-------------------------------------------------------------+                                                                                                  
|                 System Parameter Change List                |                                                                                                  
+-----------+------------------+---------------+--------------+                                                                                                  
| ip        | need_change_var  | current_value | target_value |                                                                                                  
+-----------+------------------+---------------+--------------+                                                                                                  
| 10.0.0.69 | fs.aio-max-nr    | 256000        | 1048576      |                                                                                                  
| 10.0.0.69 | vm.max_map_count | 65530         | 655360       |                                                                                                  
+-----------+------------------+---------------+--------------+                                                                                                  
Trace ID: 4e566126-14fa-11f0-a909-0050569daf00                                                                                                                   
If you want to view detailed obd logs, please run: obd display-trace 4e566126-14fa-11f0-a909-0050569daf00                                                        
Do you want to modify the parameters above? (y/n) (Default: y)n                                                                                                  
                                                                                                                                                                 
Enter the cluster name (Default: standalone; allowed characters: letters, numbers, and underscores): obeedemo                                                    
Enter the OB SQL port (Default: 2881):                                                                                                                           
Enter the OB RPC port (Default: 2882):                                                                                                                           
Enter the obshell port (Default: 2886):                                                                                                                          
Enter the OB root password (Default: xvVOaNnOGAikJtIKgLuM):                                                                                                      
Confirm the OB root password:                                                                                                                                    
Enter the OB cpu count (Default: 8):                                                                                                                             
Enter the OB memory limit (Configurable Range[6, 12], Default: 12, Unit: G):                 
Enter the OB installation directory (Default: /home/admin/obeedemo):                                                                                             
Enter the OB data directory (Default: /data/1/obeedemo):                                                                                                         
Enter the OB log directory (Default: /data/log1/obeedemo):                                                                                                       
Enter the OB datafile maxsize (Configurable Range[24, 90], Default: 90, Unit: G): 50                                                                             
Enter the OB log disk size (Configurable Range[24, 45], Default: 45, Unit: G): 45                                                                                
 Do you want to create tenant for your business workload? (y/n)(Default: y):                                                                                     
 Tenant: sys conifguration: 2C/1G/3G(CPU/Memory/Log disk)                                                                                                        
 system_memory configuration(Unit: G): 5                                        
Enter the tenant name (Default: test; allowed characters: letters, numbers, and underscores): oboracle
    Please select the tenant mode (enter the corresponding number):                                                                                              
    1) MySQL                                                                    
    2) Oracle                                                                   
Please enter your choice [1/2] (default 1):2                                                                                                                     
Enter the tenant cpu (Configurable Range[1, 6], Default: 6):                                                                                                     
Enter the tenant memory (Configurable Range[1, 6], Default: 6, Unit: G):                                                                                         
Enter the tenant log disk size(Configurable Range[18, 41], Default: 41, Unit: G): 24                                                                             
 Do you want to enable encryption for password security? (y/n) (Default: n):                                                                                     
 Do you need to install the monitoring components (OBAgent, Prometheus, Grafana)? (y/n) (Default: y):  
Enter the OBAgent monitoring service port (Default: 8088): 18088                                                                                                 
Enter the OBAgent management service port (Default: 8089): 18089                                                                                                 
Enter the Prometheus port (Default: 9090): 19090                                                                                                                 
Enter the Grafana port (Default: 3000): 13000                                                                                                                    

#Saved configurations:                                                          
 cluster name: obeedemo                                                         
 mysql port: 2881                                                               
 rpc port: 2882                                                                 
 obshell port: 2886                                                             
 cpu count: 8                                                                   
 memory limit: 12G                                                              
 home path: /home/admin/obeedemo                                                
 data dir: /data/1/obeedemo                                                     
 log dir: /data/log1/obeedemo                                                   
 datafile maxsize: 50G                                                          
log disk size: 45G                                                             
 tenant name: oboracle                                                          
 tenant cpu: 6                                                                  
 tenant memory: 6G                                                              
 tenant log disk size: 24G                                                      
 OBAgent monitoring service port: 18088                                         
 OBAgent management service port: 18089                                         
 Prometheus port: 19090                                                         
 Grafana port: 13000                                                            

 Are you sure these configurations are correct? (y/n) (Default: y):                                                                                              
Configuration confirmed.                                                        


start cluster...                                                                
Cluster param config check ok                                                   
Open ssh connection ok                                                          
Generate obagent configuration ok                                               
Generate prometheus configuration ok                                            
Generate grafana configuration ok                                               
+----------------------------------------------------------------------------------------------------+
|                                              Packages                                              |
+----------------------+---------+------------------------+------------------------------------------+
| Repository           | Version | Release                | Md5                                      |
+----------------------+---------+------------------------+------------------------------------------+
| oceanbase-standalone | 4.2.5.3 | 103000152025033110.el8 | 305669b55281773f5c53ff4e44ff9f7bed9f7bc0 |
| obagent              | 4.2.2   | 100000042024011120.el8 | bf152b880953c2043ddaf80d6180cf22bb8c8ac2 |
| prometheus           | 2.37.1  | 10000102022110211.el8  | e4f8a3e784512fca75bf1b3464247d1f31542cb9 |
| grafana              | 7.5.17  | 1                      | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
+----------------------+---------+------------------------+------------------------------------------+
Repository integrity check ok                                                   
Load param plugin ok                                                            
Open ssh connection ok                                                          
Initializes obagent work home ok                                                
Initializes observer work home ok                                               
Initializes prometheus work home ok                                             
Initializes grafana work home ok                                                
Parameter check ok                                                              
Remote oceanbase-standalone-4.2.5.3-103000152025033110.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 repository install ok
Remote oceanbase-standalone-4.2.5.3-103000152025033110.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 repository lib check ok
Remote obagent-4.2.2-100000042024011120.el8-bf152b880953c2043ddaf80d6180cf22bb8c8ac2 repository install ok
Remote obagent-4.2.2-100000042024011120.el8-bf152b880953c2043ddaf80d6180cf22bb8c8ac2 repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el8-e4f8a3e784512fca75bf1b3464247d1f31542cb9 repository install ok
Remote prometheus-2.37.1-10000102022110211.el8-e4f8a3e784512fca75bf1b3464247d1f31542cb9 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
obeedemo deployed                                                               
Get local repositories ok                                                       
Load cluster param plugin ok                                                    
Open ssh connection ok                                                          
[WARN] OBD-1011: (10.0.0.69) The recommended value of fs.aio-max-nr is 1048576 (Current value: 256000)
[WARN] OBD-1007: (10.0.0.69) The recommended number of stack size is unlimited (Current value: 8192)
[WARN] OBD-1017: (10.0.0.69) The value of the "vm.max_map_count" must be within [327600, 1310720] (Current value: 65530, Recommended value: 655360)
Check before start obagent ok                                                   
Check before start prometheus ok                                                
Check before start grafana ok                                                   
cluster scenario: None                                                          
Start observer ok                                                               
observer program health check ok                                                
Connect to observer 10.0.0.69:2881 ok                                           
oceanbase bootstrap ok                              
obshell start ok                                                                
obshell program health check ok                                                 
obshell bootstrap ok                                                            
Start obagent ok                                                                
obagent program health check ok                                                 
Start promethues ok                                                             
prometheus program health check ok                                              
Start grafana ok                                                                
grafana program health check ok                                                 
Connect to grafana ok                                                           
Grafana modify password ok                                                      
Connect to observer 10.0.0.69:2881 ok                                           
Wait for observer init ok                                                       
+---------------------------------------------+                                                                                                                  
|             oceanbase-standalone            |                                                                                                                  
+-----------+---------+------+-------+--------+                                                                                                                  
| ip        | version | port | zone  | status |                                                                                                                  
+-----------+---------+------+-------+--------+                                                                                                                  
| 10.0.0.69 | 4.2.5.3 | 2881 | zone1 | ACTIVE |                                                                                                                  
+-----------+---------+------+-------+--------+                                                                                                                  
obclient -h10.0.0.69 -P2881 -uroot@sys -p'**********' -Doceanbase -A        
cluster unique id: 5a8881fc-7232-5fea-ad14-e02c39f7866f-19618cb5923-03050204                                                                                     

Connect to Obagent ok                                                           
+--------------------------------------------------------------+                                                                                                 
|                           obagent                            |                                                                                                 
+-----------+--------------------+--------------------+--------+                                                                                                 
| ip        | mgragent_http_port | monagent_http_port | status |                                                                                                 
+-----------+--------------------+--------------------+--------+                                                                                                 
| 10.0.0.69 | 18089              | 18088              | active |                                                                                                 
+-----------+--------------------+--------------------+--------+                                                                                                 
Connect to Prometheus ok                                                        
+------------------------------------------------------+                                                                                                         
|                      prometheus                      |                                                                                                         
+------------------------+-------+------------+--------+                                                                                                         
| url                    | user  | password   | status |                                                                                                         
+------------------------+-------+------------+--------+                                                                                                         
| http://10.0.0.69:19090 | admin | vqgN2mM9yQ | active |                                                                                                         
+------------------------+-------+------------+--------+                                                                                                         
Connect to grafana ok                                                           
+-----------------------------------------------------------------+                                                                                              
|                             grafana                             |                                                                                              
+------------------------------------+-------+-----------+--------+                                                                                              
| url                                | user  | password  | status |                                                                                              
+------------------------------------+-------+-----------+--------+                                                                                              
| http://10.0.0.69:13000/d/oceanbase | admin | oceanbase | active |                                                                                              
+------------------------------------+-------+-----------+--------+                                                                                              
obeedemo running                                                                
Trace ID: 6b008d2e-14fa-11f0-bbb2-0050569daf00                                                                                                                   
If you want to view detailed obd logs, please run: obd display-trace 6b008d2e-14fa-11f0-bbb2-0050569daf00

create tenant...                                                                
Get local repositories ok                                                   
Create user in oracle tenant is not supported and --password is not supported                                                                                    
Trace ID: bf60cbe0-14fa-11f0-99d5-0050569daf00                                                                                                                   
If you want to view detailed obd logs, please run: obd display-trace bf60cbe0-14fa-11f0-99d5-0050569daf00

You can access the oboracle tenant using the following command.:                                                                                                
 For security reasons, kindly reset the root password immeditely once the tenant has been successfully created. 
 obclient -h10.0.0.69 -P2881 -uSYS@oboracle                                                                                                                      
If this cluster is for production use, please import a commercial license in time.            
1 个赞