How to Create a Cluster of Nodes Using qshell |
There are many times when it's necessary to create a cluster of nodes in qshell to perform tasks, such as pushing changes to configuration files, collecting information from nodes, rebooting a group of nodes to name just a few. Depending on the task you need to complete, the nodes included in the cluster can vary. For example, you may need to create a cluster with just Storage Nodes or a cluster that includes both Storage Nodes and Controller Nodes.
This topic describes how to:
In [1]: strg_list=['10.10.1.45', '10.10.1.46', '10.10.1.47']
In [2]: q.cluster.create('individual_nodes', 'domain.com', strg_list, 'rooter', ['rooter'], '10.20.167.248')
Out[2]:
domain:domain.com
* 10.10.1.45 10.10.1.45
* 10.10.1.46 10.10.1.46
* 10.10.1.47 10.10.1.47
Definition of parmaters:
In []: q.cluster.create('individual_nodes', 'domain.com', strg_list, 'rooter', ['rooter'], '10.20.167.248')
In []: q.cluster.create('<name_of_cluster>', '<domain_name>', <variable>, '<superadminpassword>', ['<superadminpasswords>'], '<management_controller_IP>')
In []: ca = i.config.cloudApiConnection.find('main')
In []: minfo = [(ca.machine.getManagementIpaddress(m['guid'],includevirtual=False)['result'], ca.machine.getObject(m['guid']).accounts[0].password) for m in ca.machine.list(machinerole='STORAGENODE')['result'] if m['status']=='RUNNING']
In []: minfo = zip(*sorted(minfo, key=lambda x: int(x[0].split('.')[3])))
In []: strg_clu = q.cluster.create(clustername='all_storage_nodes', domainname='tmp', ipaddresses=list(minfo[0]), masteripaddress=minfo[0][0], superadminpassword=minfo[1][0], superadminpasswords=list(minfo[1][1:]))
In []: ca = i.config.cloudApiConnection.find('main')
In []: minfo = [(ca.machine.getManagementIpaddress(m['guid'],includevirtual=False)['result'], ca.machine.getObject(m['guid']).accounts[0].password) for m in ca.machine.list(machinerole='CPUNODE')['result'] if m['status']=='RUNNING']
In []: minfo = zip(*sorted(minfo, key=lambda x: int(x[0].split('.')[3])))
In []: ctrl_clu = q.cluster.create(clustername='all_controller_nodes', domainname='tmp', ipaddresses=list(minfo[0]), masteripaddress=minfo[0][0], superadminpassword=minfo[1][0], superadminpasswords=list(minfo[1][1:]))
In []: ca = i.config.cloudApiConnection.find('main')
In []: minfo = [(ca.machine.getManagementIpaddress(m['guid'],includevirtual=False)['result'], ca.machine.getObject(m['guid']).accounts[0].password) for m in ca.machine.list()['result'] if m['status']=='RUNNING']
In []: minfo = zip(*sorted(minfo, key=lambda x: int(x[0].split('.')[3])))
In []: node_clu = q.cluster.create(clustername='all_controller_nodes', domainname='tmp', ipaddresses=list(minfo[0]), masteripaddress=minfo[0][0], superadminpassword=minfo[1][0], superadminpasswords=list(minfo[1][1:]))
In [1]: ip = []
In [2]: ip
Out[2]: []
Note: The IP range must be one larger than the range you would like to cover.
In [3]: for i in range(45, 48):
...: ip.append('10.10.1.%d'%i)
...:
...:
In [4]: ip
Out[4]: ['10.10.1.45', '10.10.1.46', '10.10.1.47']
In [5]: q.cluster.create('range_storage_nodes', 'domain.com', ip, 'rooter', ['rooter'], '10.20.167.248')
Out[5]:
domain:domain.com
* 10.10.1.45 10.10.1.45
* 10.10.1.46 10.10.1.46
* 10.10.1.47 10.10.1.47
In[5]: q.cluster.create('storage_nodes', domainname='domain.com', ipaddresses=ip, superadminpassword='rooter', superadminpasswords=['rooter'], masteripaddress=ip[0])
Out[5]:
domain:domain.com
* 10.10.1.45 10.10.1.45
* 10.10.1.46 10.10.1.46
* 10.10.1.47 10.10.1.47
In []: q.cluster.list()
In []: q.cluster.delete('all_storage_nodes_tmp')
This page was generated by the BrainKeeper Enterprise Wiki, © 2018 |