1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-4157 mcs-loadbrm.py doesn't start SM with systemd with a certain argument

This feature is used to start multi-node MCS in containers
This commit is contained in:
Roman Nozdrin
2020-08-03 17:45:21 +00:00
parent f764621615
commit ea4701caa7

View File

@@ -28,6 +28,10 @@ def get_port():
if __name__ == '__main__': if __name__ == '__main__':
# To avoid systemd in container environment
use_systemd = True
if len(sys.argv) > 1:
use_systemd = not sys.argv[1] == 'no'
sm_config = configparser.ConfigParser() sm_config = configparser.ConfigParser()
sm_config.read('/etc/columnstore/storagemanager.cnf') sm_config.read('/etc/columnstore/storagemanager.cnf')
@@ -48,13 +52,14 @@ if __name__ == '__main__':
brm_saves_current = '' brm_saves_current = ''
if storage.lower() == 's3' and not bucket.lower() == 'some_bucket': if storage.lower() == 's3' and not bucket.lower() == 'some_bucket':
# start SM # start SM using systemd
cmd = 'systemctl start mcs-storagemanager' if use_systemd is True:
retcode = subprocess.call(cmd, shell=True) cmd = 'systemctl start mcs-storagemanager'
if retcode < 0: retcode = subprocess.call(cmd, shell=True)
print('Failed to start storagemanager. \ if retcode < 0:
print('Failed to start storagemanager. \
{} exits with {}.'.format(cmd, retcode)) {} exits with {}.'.format(cmd, retcode))
sys.exit(1) sys.exit(1)
brm = 'data1/systemFiles/dbrm/BRM_saves_current' brm = 'data1/systemFiles/dbrm/BRM_saves_current'
config_root.find('./Installation/DBRootStorageType').text = "StorageManager" config_root.find('./Installation/DBRootStorageType').text = "StorageManager"
@@ -90,7 +95,7 @@ Please install CMAPI first.', file=sys.stderr)
primary_address = config_root.find('./DBRM_Controller/IPAddr').text primary_address = config_root.find('./DBRM_Controller/IPAddr').text
api_key = get_key() api_key = get_key()
if len(api_key) == 0: if len(api_key) == 0:
print('Failed to find API key in {}.'.format(api_config_file), \ print('Failed to find API key in {}.'.format(API_CONFIG_PATH), \
file=sys.stderr) file=sys.stderr)
sys.exit(1) sys.exit(1)
headers = {'x-api-key': api_key} headers = {'x-api-key': api_key}