@@ -308,7 +308,8 @@ def do_command(self):
308308 obd .set_cmds (self .cmds )
309309 ret = self ._do_command (obd )
310310 if not ret :
311- ROOT_IO .exit_msg = DOC_LINK_MSG + "\n " + ROOT_IO .exit_msg
311+ from _errno import EXIST_ERROR_CODE
312+ ROOT_IO .exit_msg = ((DOC_LINK_MSG + "\n " ) if EXIST_ERROR_CODE else '' ) + ROOT_IO .exit_msg
312313 except NotImplementedError :
313314 ROOT_IO .exception ('command \' %s\' is not implemented' % self .prev_cmd )
314315 except LockError :
@@ -839,7 +840,7 @@ def _do_command(self, obd):
839840class DemoCommand (ClusterMirrorCommand ):
840841
841842 def __init__ (self ):
842- super (DemoCommand , self ).__init__ ('demo' , 'Quickly start' )
843+ super (DemoCommand , self ).__init__ ('demo' , 'Quickly start, This is a basic setup with minimal resources. ' )
843844 self .parser .add_option ('-c' , '--components' , type = 'string' , help = "List the components. Multiple components are separated with commas. [oceanbase-ce,obproxy-ce,obagent,prometheus,grafana,ob-configserver]\n Example: \n start oceanbase-ce: obd demo -c oceanbase-ce\n "
844845 + "start -c oceanbase-ce V3.2.3: obd demo -c oceanbase-ce --oceanbase-ce.version=3.2.3\n "
845846 + "start oceanbase-ce and obproxy-ce: obd demo -c oceanbase-ce,obproxy-ce" , default = 'oceanbase-ce,obproxy-ce,obagent,prometheus,grafana' )
@@ -866,10 +867,10 @@ def _do_command(self, obd):
866867class PrefCommand (ClusterMirrorCommand ):
867868
868869 def __init__ (self ):
869- super (PrefCommand , self ).__init__ ('pref ' , 'Quickly start' )
870+ super (PrefCommand , self ).__init__ ('perf ' , 'Quickly start, This deploys OceanBase with production-optimized configuration for enhanced performance. ' )
870871 self .parser .add_option ('-c' , '--components' , type = 'string' , help = "List the components. Multiple components are separated with commas. [oceanbase-ce,obproxy-ce,obagent,prometheus,grafana,ob-configserver]\n Example: \n start oceanbase-ce: obd demo -c oceanbase-ce\n "
871- + "start -c oceanbase-ce V3.2.3: obd pref -c oceanbase-ce --oceanbase-ce.version=3.2.3\n "
872- + "start oceanbase-ce and obproxy-ce: obd pref -c oceanbase-ce,obproxy-ce" , default = 'oceanbase-ce,obproxy-ce,obagent,prometheus,grafana' )
872+ + "start -c oceanbase-ce V3.2.3: obd perf -c oceanbase-ce --oceanbase-ce.version=3.2.3\n "
873+ + "start oceanbase-ce and obproxy-ce: obd perf -c oceanbase-ce,obproxy-ce" , default = 'oceanbase-ce,obproxy-ce,obagent,prometheus,grafana' )
873874 self .parser .allow_undefine = True
874875 self .parser .undefine_warn = False
875876
@@ -885,8 +886,8 @@ def _do_command(self, obd):
885886 setattr (self .opts , 'max' , True )
886887 obd .set_options (self .opts )
887888
888- res = obd .demo (name = 'pref ' )
889- self .background_telemetry_task (obd , 'pref ' )
889+ res = obd .demo (name = 'perf ' )
890+ self .background_telemetry_task (obd , 'perf ' )
890891 return res
891892
892893
@@ -1090,6 +1091,20 @@ def _do_command(self, obd):
10901091 return self ._show_help ()
10911092
10921093
1094+ class ClusterPruneConfigCommand (ClusterMirrorCommand ):
1095+
1096+ def __init__ (self ):
1097+ super (ClusterPruneConfigCommand , self ).__init__ ('prune-config' , 'Remove configuration files for destroyed or configured clusters.' )
1098+ self .parser .add_option ('--confirm' , action = 'store_true' , help = 'Confirm to prune configuration files.' )
1099+
1100+ def _do_command (self , obd ):
1101+ if self .cmds :
1102+ res = obd .prune_config (self .cmds [0 ], need_confirm = not getattr (self .opts , 'confirm' , False ))
1103+ return res
1104+ else :
1105+ return self ._show_help ()
1106+
1107+
10931108class ClusterDisplayCommand (ClusterMirrorCommand ):
10941109
10951110 def __init__ (self ):
@@ -1204,6 +1219,8 @@ def __init__(self):
12041219 super (CLusterUpgradeCommand , self ).__init__ ('upgrade' , 'Upgrade a cluster.' )
12051220 self .parser .add_option ('-c' , '--component' , type = 'string' , help = "Component name to upgrade." )
12061221 self .parser .add_option ('-V' , '--version' , type = 'string' , help = "Target version." )
1222+ self .parser .add_option ('--tag' , type = 'string' , help = "Docker component tag." )
1223+ self .parser .add_option ('-i' , '--image-name' , type = 'string' , help = "Docker component image name." )
12071224 self .parser .add_option ('--skip-check' , action = 'store_true' , help = "Skip all the possible checks." )
12081225 self .parser .add_option ('--usable' , type = 'string' , help = "Hash list for priority mirrors, separated with `,`." , default = '' )
12091226 self .parser .add_option ('--disable' , type = 'string' , help = "Hash list for disabled mirrors, separated with `,`." , default = '' )
@@ -1212,8 +1229,12 @@ def __init__(self):
12121229 self .parser .add_option ('--ignore-standby' , '--igs' , action = 'store_true' , help = "Force upgrade, before upgrade standby tenant`s cluster." )
12131230
12141231 def _do_command (self , obd ):
1232+ oms_upgrade_mode = None
1233+ if len (self .cmds ) == 2 and self .cmds [1 ] in ['offline' , 'online' ]:
1234+ oms_upgrade_mode = self .cmds [1 ]
1235+ del self .cmds [1 ]
12151236 if self .cmds :
1216- res = obd .upgrade_cluster (self .cmds [0 ])
1237+ res = obd .upgrade_cluster (self .cmds [0 ], oms_upgrade_mode )
12171238 self .background_telemetry_task (obd )
12181239 return res
12191240 else :
@@ -1632,6 +1653,7 @@ def __init__(self):
16321653 self .register_command (ClusterStartCommand ())
16331654 self .register_command (ClusterStopCommand ())
16341655 self .register_command (ClusterDestroyCommand ())
1656+ self .register_command (ClusterPruneConfigCommand ())
16351657 self .register_command (ClusterDisplayCommand ())
16361658 self .register_command (ClusterListCommand ())
16371659 self .register_command (ClusterRestartCommand ())
@@ -2875,6 +2897,127 @@ def _do_command(self, obd):
28752897 return self ._show_help ()
28762898
28772899
2900+ class SeekdbMirrorCommand (ObdCommand ):
2901+
2902+ def init (self , cmd , args , need_deploy_name = True ):
2903+ super (SeekdbMirrorCommand , self ).init (cmd , args )
2904+ if need_deploy_name and not self .cmds :
2905+ return self ._show_help ()
2906+ return self
2907+
2908+
2909+ class SeekdbDeployCommand (SeekdbMirrorCommand ):
2910+
2911+ def __init__ (self ):
2912+ super (SeekdbDeployCommand , self ).__init__ ('deploy' , 'Deploy a seekdb cluster.' )
2913+ self .parser .add_option ('-f' , '--force' , action = 'store_true' , help = "Force deploy, clear the working directory." )
2914+ self .parser .add_option ('-C' , '--clean' , action = 'store_true' , help = "Clean deploy, clear the working directory if it belongs to the current user." )
2915+ self .parser .add_option ('-U' , '--ulp' , '--unuselibrepo' , action = 'store_true' , help = "Disable automatic dependency handling." )
2916+ self .parser .add_option ('-A' , '--act' , '--auto-create-tenant' , action = 'store_true' , help = "Auto create tenant during bootstrap." )
2917+
2918+ def _do_command (self , obd ):
2919+ if self .cmds :
2920+ obd .set_options (self .opts )
2921+ res = obd .deploy_cluster (self .cmds [0 ])
2922+ self .background_telemetry_task (obd )
2923+ return res
2924+ else :
2925+ return self ._show_help ()
2926+
2927+
2928+ class SeekdbStartCommand (SeekdbMirrorCommand ):
2929+
2930+ def __init__ (self ):
2931+ super (SeekdbStartCommand , self ).__init__ ('start' , 'Start a deployed seekdb cluster.' )
2932+ self .parser .add_option ('-s' , '--servers' , type = 'string' , help = "List of servers to be started. Multiple servers are separated with commas." )
2933+ self .parser .add_option ('-S' , '--strict-check' , action = 'store_true' , help = "Throw errors instead of warnings when check fails." )
2934+ self .parser .add_option ('--without-parameter' , '--wop' , action = 'store_true' , help = 'Start without parameters.' )
2935+
2936+ def _do_command (self , obd ):
2937+ if self .cmds :
2938+ obd .set_cmds (self .cmds [1 :])
2939+ res = obd .start_cluster (self .cmds [0 ])
2940+ self .background_telemetry_task (obd )
2941+ return res
2942+ else :
2943+ return self ._show_help ()
2944+
2945+
2946+ class SeekdbStopCommand (SeekdbMirrorCommand ):
2947+
2948+ def __init__ (self ):
2949+ super (SeekdbStopCommand , self ).__init__ ('stop' , 'Stop a started seekdb cluster.' )
2950+ self .parser .add_option ('-s' , '--servers' , type = 'string' , help = "List of servers to be stopped. Multiple servers are separated with commas." )
2951+
2952+ def _do_command (self , obd ):
2953+ if self .cmds :
2954+ obd .set_cmds (self .cmds [1 :])
2955+ res = obd .stop_cluster (self .cmds [0 ])
2956+ self .background_telemetry_task (obd )
2957+ return res
2958+ else :
2959+ return self ._show_help ()
2960+
2961+
2962+ class SeekdbRestartCommand (SeekdbMirrorCommand ):
2963+
2964+ def __init__ (self ):
2965+ super (SeekdbRestartCommand , self ).__init__ ('restart' , 'Restart a started seekdb cluster.' )
2966+ self .parser .add_option ('-s' , '--servers' , type = 'string' , help = "List of servers to be restarted. Multiple servers are separated with commas." )
2967+ self .parser .add_option ('--with-parameter' , '--wp' , action = 'store_true' , help = 'Restart with parameters.' )
2968+
2969+ def _do_command (self , obd ):
2970+ if self .cmds :
2971+ if not getattr (self .opts , 'with_parameter' , False ):
2972+ setattr (self .opts , 'without_parameter' , True )
2973+ obd .set_options (self .opts )
2974+ res = obd .restart_cluster (self .cmds [0 ])
2975+ self .background_telemetry_task (obd )
2976+ return res
2977+ else :
2978+ return self ._show_help ()
2979+
2980+
2981+ class SeekdbDestroyCommand (SeekdbMirrorCommand ):
2982+
2983+ def __init__ (self ):
2984+ super (SeekdbDestroyCommand , self ).__init__ ('destroy' , 'Destroy a deployed seekdb cluster.' )
2985+ self .parser .add_option ('-f' , '--force-kill' , action = 'store_true' , help = "Force kill the running seekdb process in the working directory." )
2986+ self .parser .add_option ('--confirm' , action = 'store_true' , help = 'Confirm to destroy.' )
2987+
2988+ def _do_command (self , obd ):
2989+ if self .cmds :
2990+ res = obd .destroy_cluster (self .cmds [0 ], need_confirm = not getattr (self .opts , 'confirm' , False ))
2991+ return res
2992+ else :
2993+ return self ._show_help ()
2994+
2995+
2996+ class SeekdbDisplayCommand (SeekdbMirrorCommand ):
2997+
2998+ def __init__ (self ):
2999+ super (SeekdbDisplayCommand , self ).__init__ ('display' , 'Display the information for a seekdb cluster.' )
3000+ self .parser .add_option ('--encryption-passkey' , '--epk' , type = 'string' , help = "Encryption passkey." )
3001+
3002+ def _do_command (self , obd ):
3003+ if self .cmds :
3004+ return obd .display_cluster (self .cmds [0 ])
3005+ else :
3006+ return self ._show_help ()
3007+
3008+
3009+ class SeekdbMajorCommand (MajorCommand ):
3010+
3011+ def __init__ (self ):
3012+ super (SeekdbMajorCommand , self ).__init__ ('seekdb' , 'Deploy and manage a seekdb cluster.' )
3013+ self .register_command (SeekdbDeployCommand ())
3014+ self .register_command (SeekdbStartCommand ())
3015+ self .register_command (SeekdbStopCommand ())
3016+ self .register_command (SeekdbRestartCommand ())
3017+ self .register_command (SeekdbDestroyCommand ())
3018+ self .register_command (SeekdbDisplayCommand ())
3019+
3020+
28783021class MainCommand (MajorCommand ):
28793022
28803023 def __init__ (self ):
@@ -2885,6 +3028,7 @@ def __init__(self):
28853028 self .register_command (WebCommand ())
28863029 self .register_command (MirrorMajorCommand ())
28873030 self .register_command (ClusterMajorCommand ())
3031+ self .register_command (SeekdbMajorCommand ())
28883032 self .register_command (RepositoryMajorCommand ())
28893033 self .register_command (TestMajorCommand ())
28903034 self .register_command (UpdateCommand ())
0 commit comments