How to Create a Cluster of Nodes Using qshell

Overview

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:

 


Create a Cluster for Specific Nodes

  1. Create a variable containing the IP addresses of the desired nodes:

In [1]: strg_list=['10.10.1.45', '10.10.1.46', '10.10.1.47']

 

  1. Create the cluster pulling information from the previously created variable:

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>')
 

 


Create a Cluster for RUNNING STORAGE Nodes in an Environment

  1. Enter the following qshell commands to create a cluster for running storage nodes:

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:]))
 


 

Create a Cluster for RUNNING CONTROLLER nodes in an Environment

  1. Enter the following qshell commands to create a cluster for running controller nodes:

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:]))

 


Create a Cluster for ALL RUNNING NODES in an Environment

  1. Enter the following qshell commands to create a cluster for all running nodes (storage and controller):

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:]))

 

 


Create a Cluster with a Range of Nodes

  1. Set blank ip variable:

In [1]: ip = []


In [2]: ip


Out[2]: []

 

  1. Select the range based on the IP address:

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)
   ...:
   ...:

 

  1. Confirm the range is complete:

In [4]: ip

Out[4]: ['10.10.1.45', '10.10.1.46', '10.10.1.47']

 

  1. Create the cluster:

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

 

  1. Optional command:

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

 


List Existing Clusters

  1. To list existing clusters, enter the following qshell command:

In []: q.cluster.list()

 


Delete a Cluster

  1. To delete a cluster, enter the following command:

In []: q.cluster.delete('all_storage_nodes_tmp')

 


Related Information



This page was generated by the BrainKeeper Enterprise Wiki, © 2018