未验证 提交 ee5a76bb 编写于 作者: R Rongfeng Fu 提交者: GitHub

Support obproxy ce (#94)

* support obproxy-ce
上级 10ac254f
...@@ -2189,7 +2189,7 @@ class ObdHome(object): ...@@ -2189,7 +2189,7 @@ class ObdHome(object):
deploy_config = deploy.deploy_config deploy_config = deploy.deploy_config
if opts.component is None: if opts.component is None:
for component_name in ['obproxy', 'oceanbase', 'oceanbase-ce']: for component_name in ['obproxy', 'obproxy-ce', 'oceanbase', 'oceanbase-ce']:
if component_name in deploy_config.components: if component_name in deploy_config.components:
opts.component = component_name opts.component = component_name
break break
...@@ -2357,7 +2357,7 @@ class ObdHome(object): ...@@ -2357,7 +2357,7 @@ class ObdHome(object):
self._call_stdio('verbose', 'Get deploy configuration') self._call_stdio('verbose', 'Get deploy configuration')
deploy_config = deploy.deploy_config deploy_config = deploy.deploy_config
allow_components = ['obproxy', 'oceanbase', 'oceanbase-ce'] allow_components = ['obproxy', 'obproxy-ce', 'oceanbase', 'oceanbase-ce']
if opts.component is None: if opts.component is None:
for component_name in allow_components: for component_name in allow_components:
if component_name in deploy_config.components: if component_name in deploy_config.components:
...@@ -2423,7 +2423,7 @@ class ObdHome(object): ...@@ -2423,7 +2423,7 @@ class ObdHome(object):
connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository] connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository]
if repository.name == 'obproxy': if repository.name in ['obproxy', 'obproxy-ce']:
ob_optimization = False ob_optimization = False
allow_components = ['oceanbase', 'oceanbase-ce'] allow_components = ['oceanbase', 'oceanbase-ce']
for component_name in deploy_config.components: for component_name in deploy_config.components:
...@@ -2583,7 +2583,7 @@ class ObdHome(object): ...@@ -2583,7 +2583,7 @@ class ObdHome(object):
self._call_stdio('verbose', 'Get deploy configuration') self._call_stdio('verbose', 'Get deploy configuration')
deploy_config = deploy.deploy_config deploy_config = deploy.deploy_config
allow_components = ['obproxy', 'oceanbase', 'oceanbase-ce'] allow_components = ['obproxy', 'obproxy-ce', 'oceanbase', 'oceanbase-ce']
if opts.component is None: if opts.component is None:
for component_name in allow_components: for component_name in allow_components:
if component_name in deploy_config.components: if component_name in deploy_config.components:
...@@ -2649,7 +2649,7 @@ class ObdHome(object): ...@@ -2649,7 +2649,7 @@ class ObdHome(object):
connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository] connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository]
if repository.name == 'obproxy': if repository.name in ['obproxy', 'obproxy-ce']:
ob_optimization = False ob_optimization = False
allow_components = ['oceanbase', 'oceanbase-ce'] allow_components = ['oceanbase', 'oceanbase-ce']
for component in deploy_info.components: for component in deploy_info.components:
......
...@@ -33,6 +33,11 @@ def bootstrap(plugin_context, cursor, *args, **kwargs): ...@@ -33,6 +33,11 @@ def bootstrap(plugin_context, cursor, *args, **kwargs):
inner_config = { inner_config = {
InnerConfigItem('$_zone_idc'): 'idc' InnerConfigItem('$_zone_idc'): 'idc'
} }
has_obproxy = False
for componet_name in ['obproxy', 'obproxy-ce']:
if componet_name in plugin_context.components:
has_obproxy = True
break
inner_keys = inner_config.keys() inner_keys = inner_config.keys()
for server in cluster_config.servers: for server in cluster_config.servers:
server_config = cluster_config.get_server_conf(server) server_config = cluster_config.get_server_conf(server)
...@@ -67,7 +72,7 @@ def bootstrap(plugin_context, cursor, *args, **kwargs): ...@@ -67,7 +72,7 @@ def bootstrap(plugin_context, cursor, *args, **kwargs):
stdio.verbose('execute sql: %s' % sql) stdio.verbose('execute sql: %s' % sql)
cursor.execute(sql) cursor.execute(sql)
global_conf = cluster_config.get_global_conf() global_conf = cluster_config.get_global_conf()
if 'proxyro_password' in global_conf or 'obproxy' in plugin_context.components: if has_obproxy or 'proxyro_password' in global_conf:
value = global_conf['proxyro_password'] if global_conf.get('proxyro_password') is not None else '' value = global_conf['proxyro_password'] if global_conf.get('proxyro_password') is not None else ''
sql = 'create user "proxyro" IDENTIFIED BY %s' sql = 'create user "proxyro" IDENTIFIED BY %s'
stdio.verbose(sql) stdio.verbose(sql)
......
...@@ -75,15 +75,17 @@ def generate_config(plugin_context, deploy_config, *args, **kwargs): ...@@ -75,15 +75,17 @@ def generate_config(plugin_context, deploy_config, *args, **kwargs):
if not cluster_config.get_global_conf().get('appname'): if not cluster_config.get_global_conf().get('appname'):
default_appname = 'obcluster' default_appname = 'obcluster'
if 'obproxy' in deploy_config.components: for componet_name in ['obproxy', 'obproxy-ce']:
obproxy_cluster_config = deploy_config.components['obproxy'] if componet_name in deploy_config.components:
cluster_name = obproxy_cluster_config.get_global_conf().get('cluster_name') obproxy_cluster_config = deploy_config.components[componet_name]
if not cluster_name: cluster_name = obproxy_cluster_config.get_global_conf().get('cluster_name')
for server in obproxy_cluster_config.servers: if not cluster_name:
server_config = obproxy_cluster_config.get_server_conf(server) for server in obproxy_cluster_config.servers:
if server_config.get('cluster_name'): server_config = obproxy_cluster_config.get_server_conf(server)
default_appname = server_config['cluster_name'] if server_config.get('cluster_name'):
break default_appname = server_config['cluster_name']
break
break
cluster_config.update_global_conf('appname', default_appname, False) cluster_config.update_global_conf('appname', default_appname, False)
MIN_MEMORY = 8 << 30 MIN_MEMORY = 8 << 30
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册