«

»

Create & Configure Nutanix Cluster via command line

Updated 2018-04-27: Updated Set new Nutanix Cluster Admin Password

Updated 2018-01-18: Updated Directory Authentication section to match AOS 5.5 requirements.

Updated 2017-09-06: Updated to include local PRISM users

Updated 2017-05-31: Updated to include Network Visualization

Updated 2017-05-31: Updated to include configure External Data Services IP address

Updated 2017-05-31: Updated the section where a new container is created and changed inline compression to post compression, see section here.

Updated 2017-03-02: Mounting Nutanix Container to ESXi hosts

Updated 2017-01-28: Change Nutanix Cluster admin user password

Originally posted: 2016-09-01

——————————————————————————————————————————

I have received a few questions about creating and configure a Nutanix cluster via cli. Since i’m doing that pretty much one-two times per quarter when changing hypervisor in my cluster i figure i can share the commands i’m using.

You can create a bash script with static parameters or with user interaction requirements but the below is just plain text you can copy into any CVMs shell.

Create the Nutanix Cluster

This is really simple and takes only one command. The only pre req is that you have set IP address of the CVMs eth0 interface.

Important: Use the script at the end of the blog post so you don’t need to copy and paste each section individually. Find the Configuration Script here.

You run the cluster create command and in my example below i have added some parameters available during the creation process:

  •  –redundancy_factor – with the two options 2 or 3 (requires min 5 Nutanix nodes).
  • –cluster_name – The Nutanix cluster name
  • –cluster_external_ip – The Nutanix cluster IP address
  • –dns_servers – IP to the DNS servers
  • –ntp_servers – FQDN to the NTP servers
cluster --dns_servers=10.20.200.3,8.8.8.8 --ntp_servers=time01.npx5.local --redundancy_factor=2 -s 10.20.200.131,10.20.200.132,10.20.200.133 --cluster_name=NPX5 --cluster_external_ip=10.20.200.135 create

Configure the Nutanix Cluster

The following section contains the a mix of parameters i use in my cluster and parameters i use during Nutanix cluster implementations.

  • Set time zone
    ncli cluster set-timezone timezone=Europe/Stockholm
  • Set new Nutanix Cluster Admin password
    ncli user reset-password user-name=admin password=NewPassword2!
  • Add local PRISM users with – will be added with read only permissions
    ncli user add user-name=magnus user-password=Secret!2u email-id=magnus.andersson@npx5.com first-name=Magnus last-name=Andersson
  • Grant the newly created user the User Admin Role
    user grant-user-admin-role user-name=magnus
  •  Set External Data Services IP Address
    cluster edit-params external-data-services-ip-address=10.10.100.115
  • Configure directory authentication
    ncli authconfig add-directory directory-type=ACTIVE_DIRECTORY connection-type=LDAP directory-url=ldap://npx5.local:3268 domain=npx5.local name=NPX5 service-account-username=service_account@npx5.local service-account-password=bestPassword
  • Add Active Directory group to PRISM with user admin rights
    ncli authconfig add-role-mapping role=ROLE_USER_ADMIN entity-type=GROUP entity-values="NPX5 Admins" name=NPX5
  • Set SMTP Configuration
    ncli cluster set-smtp-server port=25 from-email-address=nutanix@npx5.local address=10.10.100.174
  • Enable syslog with level warning for all components
    ncli rsyslog-config set-status enable=false
    ncli rsyslog-config add-server name=npx5syslog ip-address=10.10.100.154 port=514 network-protocol=udp
    ncli rsyslog-config add-module server-name=npx5syslog module-name=acropolis level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=cassandra level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=cerebro level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=curator level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=genesis level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=prism level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=stargate level=ERROR
    ncli rsyslog-config add-module server-name=npx5syslog module-name=zookeeper level=ERROR
    ncli rsyslog-config set-status enable=true
  • Set proxy server
    ncli http-proxy add name=NPX5-proxy address=proxy.npx5.local port=8080 proxy-types=HTTPS
  • Set proxy server whitelist. Good if you use e.g. PRISM Central and don’t need Proxy to reach it
    ncli http-proxy add-to-whitelist target-type=ipv4_address target=10.10.100.144
  • Enable pulse
    ncli pulse-config update enable-default-nutanix-email=true email-contacts=mandersson@npx5.local,x.y@domain.com enable="true"
  • Enable email alerts
    ncli alerts edit-alert-config enable="true" enable-default-nutanix-email="true" email-contacts="mandersson@npx5.local,x.y@domain.com"
  • Configure Network Visualization
    • SNMP Profile using SNMP version 2
      ncli net add-snmp-profile community=npx5 name=aristanpx5 version=snmpv2c
    • Switch Configuration adding 3 AHV Hosts
      ncli net add-switch-config snmp-profile-name=aristanpx5 switch-address=10.20.200.253 host-addresses=10.20.200.121,10.20.200.122,10.20.200.123
  • Get Storage Pool name
    spid=`ncli sp list | grep -i name | awk '{print $3}'`
  • Get Default Container name
    dctr=`ncli ctr list | grep -i VStore | grep -i default | awk '{print $4}'`
  • Delete default container
    ncli ctr remove name=$dctr
  • Create container with name ctr01, post compression turned on with 60 min delay and replication factor set to 2.
    ncli ctr create name=ctr01 rf=2 sp-name=$spid enable-compression=true compression-delay=60
  • If running ESXi you might want to mount the container as a NFS datastore to the ESXi hosts in the cluster. If so, use the following command:
    ncli datastore add ctr-name="ctr01" name="ctr01" host-ids=default read-only="false"
    • If you want to mount the container to a specific set of ESXi hosts you need to provide the host-ids which you can find by running the following command from any CVM in the Nutanix Cluster.
      ncli host ls |grep 'Name\|Id'; ncli host ls | grep Id | awk -F ":" '{print $4}'

      The above command will display an output according to the below figure where the first output lists both the ESXi host Name and ID and the second part just lists the ESXi host Id which you need.

    • If you want to mount the Container to the A & C ESXi host you run the following command:
      ncli datastore add ctr-name="ctr01" name="ctr01" host-ids=4,6 read-only="false"

So that’s about it. Anything you normally use and you want me to add, please let me know.

If not, happy Nutanix cluster creation & configuration:)

Configuration Script

—– Same thing as above but without any unnecessary text —–

# Initial Cluster Create Cluster 
cluster --dns_servers=10.20.200.3,8.8.8.8 --ntp_servers=time01.npx5.local --redundancy_factor=2 -s 10.20.200.131,10.20.200.132,10.20.200.133 --cluster_name=NPX5 --cluster_external_ip=10.20.200.135 create
sleep 240
# Time Zone
ncli cluster set-timezone timezone=Europe/Stockholm
sleep 10
# Set new Admin password
ncli user reset-password user-name=admin password=NewPassword2!
sleep 10
# Add local PRISM users and add User Admin Role
user grant-user-admin-role user-name=magnus
ncli user add user-name=magnus user-password=Secret!2u email-id=magnus.andersson@npx5.com first-name=Magnus last-name=Andersson
sleep 10
# Data Services IP
ncli cluster edit-params external-data-services-ip-address=10.10.100.115
sleep 10
# Active Directory authentication
ncli authconfig add-directory directory-type=ACTIVE_DIRECTORY connection-type=LDAP directory-url=ldap://npx5.local:3268 domain=npx5.local name=NPX5 service-account-username=service_account@npx5.local service-account-password=bestPassword
sleep 10
ncli authconfig add-role-mapping role=ROLE_USER_ADMIN entity-type=GROUP entity-values="NPX5 Admins" name=NPX5
sleep 10
# SMTP Server
ncli cluster set-smtp-server port=25 from-email-address=nutanix@npx5.local address=10.10.100.174
sleep 10
# Syslog
ncli rsyslog-config set-status enable=false
sleep 10
ncli rsyslog-config add-server name=npx5syslog ip-address=10.10.100.154 port=514 network-protocol=udp
ncli rsyslog-config add-module server-name=npx5syslog module-name=acropolis level=ERROR
ncli rsyslog-config add-module server-name=npx5syslog module-name=cassandra level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=cerebro level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=curator level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=genesis level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=prism level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=stargate level=ERROR ncli rsyslog-config add-module server-name=npx5syslog module-name=zookeeper level=ERROR
sleep 10
ncli rsyslog-config set-status enable=true
sleep 10
# Proxy Server
ncli http-proxy add name=NPX5-proxy address=proxy.npx5.local port=8080 proxy-types=HTTPS
sleep 10
# Proxy when e.g. PRISM Central does not require proxy
ncli http-proxy add-to-whitelist target-type=ipv4_address target=10.10.100.144
sleep 10
# Pulse 
ncli pulse-config update enable-default-nutanix-email=true email-contacts=mandersson@npx5.local,x.y@domain.com enable="true"
sleep 10
# Alert 
ncli alerts edit-alert-config enable="true" enable-default-nutanix-email="true" email-contacts="mandersson@npx5.local,x.y@domain.com"
# Network Visualization
ncli net add-snmp-profile community=npx5 name=aristanpx5 version=snmpv2c
sleep 10
ncli net add-switch-config snmp-profile-name=aristanpx5 switch-address=10.20.200.253 host-addresses=10.20.200.121,10.20.200.122,10.20.200.123
sleep 10
# Container cleanup and creation
spid=`ncli sp list | grep -i name | awk '{print $3}'`
dctr=`ncli ctr list | grep -i VStore | grep -i default | awk '{print $4}'`
ncli ctr remove name=$dctr
sleep 10
ncli ctr create name=ctr01 rf=2 sp-name=$spid enable-compression=true compression-delay=60
sleep 10
ncli datastore add ctr-name="ctr01" name="ctr01" read-only="false"
sleep 10
# Mount container to ESXi hosts meaning not applicable to AHV and Hyper-V
ncli datastore add ctr-name="ctr01" name="ctr01" host-ids=default read-only="false"

 

8 pings

Skip to comment form

Comments have been disabled.