Skip to content

Commit

Permalink
V2.6.2 (#192)
Browse files Browse the repository at this point in the history
* V2.6.2
  • Loading branch information
frf12 authored Mar 4, 2024
1 parent 4740aa7 commit e69168f
Show file tree
Hide file tree
Showing 42 changed files with 264 additions and 193 deletions.
2 changes: 1 addition & 1 deletion plugins/grafana/7.5.17/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{udp*,tcp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{udp*,tcp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/ob-configserver/1.0.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/tcp*' | awk -F' ' '{print $2,$10}' | grep ':%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/tcp*' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/obagent/0.1/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/obagent/1.1.1/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/obagent/1.3.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_missing_required_parameters(parameters):

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/oblogproxy/2.0.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/obproxy/3.1.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
28 changes: 5 additions & 23 deletions plugins/oceanbase-diagnostic-tool/1.5/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ def parse_empty(value,default=''):
def get_obdiag_config():
# obproxy
obproxy_depend = None
obproxy_ip = None
obproxy_port = None
for comp in ['obproxy', 'obproxy-ce']:
if comp in deploy_config.components:
obproxy_depend = comp
obproxy_servers = deploy_config.components[comp].servers
obproxy_server = obproxy_servers[0]
obproxy_ip = obproxy_server.ip
obproxy_port = deploy_config.components[comp].get_server_conf(obproxy_servers[0]).get("listen_port")
break
obproxy_nodes = []
if obproxy_depend:
Expand Down Expand Up @@ -93,25 +89,11 @@ def get_obdiag_config():
observer_nodes.append(nodeItem)
sys_tenant_conf = {}
if len(ob_services) > 0:
if obproxy_ip and obproxy_port:
obcluster_config["db_host"] = obproxy_ip
obcluster_config["db_port"] = obproxy_port
sys_tenant_conf["user"] = 'root@proxysys'
obproxy_sys_password = deploy_config.components[comp].get_global_conf().get("obproxy_sys_password")
sys_tenant_conf["password"] = obproxy_sys_password if obproxy_sys_password else ''
else:
port = 2881
if global_conf.get('mysql_port') is not None:
port = global_conf.get('mysql_port')
else:
port = cluster_config.get_server_conf(ob_services[0]).get("mysql_port")
if global_conf.get('root_password') is not None:
sys_tenant_conf["password"] = global_conf.get('root_password')
else:
sys_tenant_conf["password"] = ''
sys_tenant_conf["user"] = 'root@sys'
obcluster_config["db_host"] = ob_services[0].ip
obcluster_config["db_port"] = port
port = cluster_config.get_server_conf(ob_services[0]).get("mysql_port", 2881)
sys_tenant_conf["password"] = global_conf.get('root_password', '')
sys_tenant_conf["user"] = 'root@sys'
obcluster_config["db_host"] = ob_services[0].ip
obcluster_config["db_port"] = port
obcluster_config["ob_cluster_name"] = deploy_name
obcluster_config["tenant_sys"] = sys_tenant_conf
obcluster_config["servers"] = {"nodes": observer_nodes, "global": {}}
Expand Down
2 changes: 1 addition & 1 deletion plugins/oceanbase/3.1.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/oceanbase/4.0.0.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
34 changes: 17 additions & 17 deletions plugins/oceanbase/4.2.0.0/parameter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@
need_redeploy: true
description_en: the directory for the ilog file
description_local: 存储ilog数据的目录
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 服务进程绑定的网卡设备名
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: rpc_port
name_local: 内部通信端口
require: true
Expand Down Expand Up @@ -1214,6 +1197,23 @@
need_restart: true
description_en: the number of CPUs in the system. If this parameter is set to zero, the number will be set according to sysconf; otherwise, this parameter is used.
description_local: 系统CPU总数,如果设置为0,将自动检测
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 非必填, 服务进程绑定的网卡设备名, 默认通过配置的ip设置local_ip, 如果预检查失败可通过配置此项来指定网卡
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: appname
require: false
type: SAFE_STRING
Expand Down
2 changes: 1 addition & 1 deletion plugins/oceanbase/4.2.0.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
34 changes: 17 additions & 17 deletions plugins/oceanbase/4.2.1.0/parameter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@
need_redeploy: true
description_en: the directory for the ilog file
description_local: 存储ilog数据的目录
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 服务进程绑定的网卡设备名
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: rpc_port
name_local: 内部通信端口
require: true
Expand Down Expand Up @@ -1214,6 +1197,23 @@
need_restart: true
description_en: the number of CPUs in the system. If this parameter is set to zero, the number will be set according to sysconf; otherwise, this parameter is used.
description_local: 系统CPU总数,如果设置为0,将自动检测
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 非必填, 服务进程绑定的网卡设备名, 默认通过配置的ip设置local_ip, 如果预检查失败可通过配置此项来指定网卡
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: appname
require: false
type: SAFE_STRING
Expand Down
36 changes: 18 additions & 18 deletions plugins/oceanbase/4.2.2.0/parameter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@
need_redeploy: true
description_en: the directory for the ilog file
description_local: 存储ilog数据的目录
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 服务进程绑定的网卡设备名
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: rpc_port
name_local: 内部通信端口
require: true
Expand Down Expand Up @@ -1226,6 +1209,23 @@
need_restart: true
description_en: the number of CPUs in the system. If this parameter is set to zero, the number will be set according to sysconf; otherwise, this parameter is used.
description_local: 系统CPU总数,如果设置为0,将自动检测
- name: devname
name_local: 网卡名
essential: true
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: name of network adapter
description_local: 非必填, 服务进程绑定的网卡设备名, 默认通过配置的ip设置local_ip, 如果预检查失败可通过配置此项来指定网卡
- name: local_ip
name_local: 本机ip
type: SAFE_STRING
min_value: NULL
max_value: NULL
need_restart: true
description_en: local ip address
description_local: 本机ip地址
- name: appname
require: false
type: SAFE_STRING
Expand Down Expand Up @@ -1880,4 +1880,4 @@
default: ''
need_redeploy: true
description_en: The password for obagent monitor user
description_local: obagent 监控用户的密码
description_local: obagent 监控用户的密码
16 changes: 4 additions & 12 deletions plugins/oceanbase/4.2.2.0/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,15 @@
success = True
production_mode = False

def format_for_proc_net_tcp4(ip_address, port):
ip_int = int.from_bytes(socket.inet_aton(ip_address), byteorder=sys.byteorder) #
port_hex = hex(port)[2:].upper().zfill(4)
ip_hex = hex(ip_int)[2:].upper().zfill(8)
formatted_address = f"{ip_hex}:{port_hex}"
return formatted_address

def get_port_socket_inode(client, port, ip='0.0.0.0'):
formatted_address = format_for_proc_net_tcp4(ip, port)
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{print $2,$10}' | grep '%s' | awk -F' ' '{print $2}' | uniq" % formatted_address
def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{tcp*,udp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
stdio.verbose(res.stdout)
return res.stdout.strip().split('\n')


def parse_size(size):
_bytes = 0
if not isinstance(size, str) or size.isdigit():
Expand Down Expand Up @@ -387,7 +379,7 @@ def system_memory_check():
'server': server,
'key': key
}
if (key == 'obshell_port' and get_port_socket_inode(client, port, ip)) or get_port_socket_inode(client, port):
if get_port_socket_inode(client, port):
critical('port', err.EC_CONFLICT_PORT.format(server=ip, port=port), [err.SUG_USE_OTHER_PORT.format()])

if parameter_check:
Expand Down
10 changes: 5 additions & 5 deletions plugins/ocp-express/1.0.1/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def start(plugin_context, start_env=None, *args, **kwargs):
port = server_config['port']
pid_path = os.path.join(home_path, 'run/ocp-express.pid')
pids = client.execute_command("cat %s" % pid_path).stdout.strip()
bootstrap_flag = client.execute_command('ls %s'%os.path.join(home_path, '.bootstrapped'))
bootstrap_flag = client.execute_command('ls %s' % os.path.join(home_path, '.bootstrapped'))
if pids and all([client.execute_command('ls /proc/%s' % pid) for pid in pids.split('\n')]):
server_pid[server] = pids
continue
Expand Down Expand Up @@ -399,18 +399,18 @@ def start(plugin_context, start_env=None, *args, **kwargs):
public_key_str = get_plain_public_key(public_key)
jdbc_password = rsa_private_sign(jdbc_password, private_key)
else:
public_key_str = ''
public_key_str = ""
memory_size = server_config['memory_size']
jvm_memory_option = "-Xms{0} -Xmx{0}".format(format_size(parse_size(memory_size) * 0.5, 0).lower())
java_bin = server_config['java_bin']
cmd = '{java_bin} -jar {jvm_memory_option} -DJDBC_URL={jdbc_url} -DJDBC_USERNAME={jdbc_username}' \
'{public_key} {home_path}/lib/ocp-express-server.jar --port={port}'.format(
' -DPUBLIC_KEY={public_key} {home_path}/lib/ocp-express-server.jar --port={port}'.format(
java_bin=java_bin,
home_path=home_path,
port=port,
jdbc_url=jdbc_url,
jdbc_username=jdbc_username,
public_key=' -DPUBLIC_KEY={}'.format(public_key_str) if public_key_str else "",
public_key=public_key_str,
jvm_memory_option=jvm_memory_option
)
if "log_dir" not in server_config:
Expand Down Expand Up @@ -500,7 +500,7 @@ def start(plugin_context, start_env=None, *args, **kwargs):
return plugin_context.return_false()
else:
stdio.stop_loading('succeed')
plugin_context.return_true()
plugin_context.return_true(need_bootstrap=True)

return False

2 changes: 1 addition & 1 deletion plugins/ocp-express/1.0.1/start_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_missing_required_parameters(parameters):

def get_port_socket_inode(client, port):
port = hex(port)[2:].zfill(4).upper()
cmd = "bash -c 'cat /proc/net/{udp*,tcp*}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq" % port
cmd = "bash -c 'cat /proc/net/{udp*,tcp*}' | awk -F' ' '{if($4==\"0A\") print $2,$4,$10}' | grep ':%s' | awk -F' ' '{print $3}' | uniq" % port
res = client.execute_command(cmd)
if not res or not res.stdout.strip():
return False
Expand Down
6 changes: 3 additions & 3 deletions plugins/ocp-express/1.0/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def start(plugin_context, start_env=None, *args, **kwargs):
jdbc_password = rsa_private_sign(jdbc_password, private_key)
system_password = rsa_private_sign(system_password, private_key)
else:
public_key_str = ''
public_key_str = ""
memory_size = server_config['memory_size']
jvm_memory_option = "-Xms{0} -Xmx{0}".format(format_size(parse_size(memory_size) * 0.5, 0).lower())
extra_options = {
Expand All @@ -385,14 +385,14 @@ def start(plugin_context, start_env=None, *args, **kwargs):
extra_options_str = ' '.join(["-D{}={}".format(k, v) for k, v in extra_options.items()])
java_bin = server_config['java_bin']
cmd = '{java_bin} -jar {jvm_memory_option} -DJDBC_URL={jdbc_url} -DJDBC_USERNAME={jdbc_username} -DJDBC_PASSWORD={jdbc_password} ' \
'{public_key} {extra_options_str} {home_path}/lib/ocp-express-server.jar --port={port}'.format(
'-DPUBLIC_KEY={public_key} {extra_options_str} {home_path}/lib/ocp-express-server.jar --port={port}'.format(
java_bin=java_bin,
home_path=home_path,
port=port,
jdbc_url=jdbc_url,
jdbc_username=jdbc_username,
jdbc_password=jdbc_password,
public_key=' -DPUBLIC_KEY={}'.format(public_key_str) if public_key_str else "",
public_key=public_key_str,
jvm_memory_option=jvm_memory_option,
extra_options_str=extra_options_str,
)
Expand Down
Loading

0 comments on commit e69168f

Please sign in to comment.