Skip to content

VMware Vsphere

manishingole-coder edited this page Feb 19, 2020 · 10 revisions

Vmware (vsphere)

Introduction:

This document will take you through steps of creating and configuring the database cluster ( 3 nodes, 1 Master and 2 standby ) in the Vmware vsphere. It also provides scripts to deploy EDB tools like Failover Manager, Postgres Enterprise Manager, etc. We have used Terraform for the provisioning of the infrastructure and Ansible for configuration of EDB software on the provisioned nodes.

We have used centos7 as base template for the creation of vm.

Prerequisite:

  • Terraform installed on your machine
  • Ansible installed on your machine.
  • Vmware vsphere access information and rights
  • Centos-7 Template created with GNOME configured
  • Subscription for EDB yum repository(If using EDB Postgres)
  • sshpass installed on your machine
  •        (Mac - sshpass -  brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb)
    

Install Terraform:

You can install terraform by following instructions here. We have have tested with terraform version 0.12.18

Install Ansible:

You can install Ansible by following instruction here

Subscription for EDB yum repository:

If you are installing EDB Postgresql you need EDB yum repository credentials to download software. This you have to provide in a terraform input file.

Create a 3 node DB cluster.

Installation and configuration:

Download deployment scripts from the git repository. The file will download in the folder. Go inside DB_Cluster_VMWARE folder and edit the file having .tf extension using your favorite editor.

Each field has its description commented out. Please fill the input parameter.

  • EDB_yumrepo_username
  • EDB_yumrepo_password
  • dcname
  • ssh_user
  • ssh_password
  • dbengine
  • replication_type
  • replication_password
  • db_user
  • db_password
  • cpucore
  • ramsize
  • template_name
  • user
  • password
  • vsphere_server
  • datastore
  • compute_cluster
  • network

Though you can find field descriptions in the input file, here are detailed explanations for each of the fields.

EDB_Yum_Repo_Username and EDB_Yum_Repo_Password

This is a mandatory field if you have selected enterprise postgres(epas10,epas11,epas12) as your DB engine. Optional field if you have selected postgres (pg10,pg11,pg12) as your DB engine.

dcname

This is the name of the datacenter in vmware vsphere.

ssh_password

This is a mandatory field. Provide password for the ssh_user.

ssh_user

This is the ssh user name you can provide who will login and configure the DB cluster with replication. By default username is root however you can provide user name of your choice. Make sure this user has all the privileges.

dbengine

We are providing an option to select different DB engines and create a cluster with it. These DB engines are as follows.

Name DBengine
For postgresql version 10 pg10
For postgresql version 11 pg11
For postgresql version 12 pg12
For Enterprise postgresql version 10 epas10
For Enterprise postgresql version 11 epas11
For Enterprise postgresql version 12 epas12

replication_password

We are creating 3 node clusters with replication set up among those. This field will set a replication password for replication role edbrepuser, which we are creating on your behalf and assigning the password of your choice.

db_password

This is a custom DB password for your dbuser. If you leave this field blank default password will be postgres.

cpucore

Provide number of cpu core for your new vm.

ramsize

Provide ramsize for your new vm.

template_name

Provide name of template created in vmware vsphere.This is base template with centos 7 ISO image and configured with at least one user.

user

Provide username of vmware vsphere user.

password

Provide password of vmware vsphere username

vsphere_server

Provide vmware vsphere server address or URL

datastore

Provide storage name in your datacenter

compute_cluster

Provide a compute cluster name in your datacenter.

network

Provide network name in your datacenter.

Once you edit a file and supplied mandatory fields save this file and exit from it.

Deploy

Run following command to start running terraform config file. Make sure you are in the same directory where terraform input file is present

terraform init

terraform apply

This will prompt you to enter yes. Type yes and hit enter. This will start the process of creating a cluster. If successful it will display IP’s of 3 node clusters.

SetUp EFM Cluster

Introduction

In this document, we will walk you through steps of setting up EFM on the cluster which was created earlier.

Prerequisite

The DB cluster for which EFM we are going to set must be created using EDB deployment scripts.

Installation and configuration

Download the deployment scripts from the git repository. This will download the directory. Go inside EFM_Setup_VMWARE directory and open an input file in your favorite editor having .tf extension.

Add the below fields in that file. You can read the description of those fields that are commented out.

  • EDB_Yum_Repo_Username
  • EDB_Yum_Repo_Password
  • ssh_password
  • notification_email_address
  • efm_role_password
  • db_user

Though you can find field descriptions in the input file, here are detailed explanations for each of the fields.

EDB_Yum_Repo_Username and EDB_Yum_Repo_Password

This is a mandatory field if you have selected Postgres(pg10,pg11,pg12) as your DB engine. Optional field if you have selected enterprisedb as your dbengine as this field already configured when you have created cluster previously.

ssh_password

This is a ssh_user password to connect vm.

notification_email_address

Provide an email address where you will receive a notification related to your EFM cluster operation.

efm_role_password

We are creating a separate DB role for EFM operation called edbefm and assigning permission to perform operations required in failover management. In this field, you need to provide a password for this role.

db_user

If you have created a custom DB user while creating the cluster you need to provide a name for that user. This field we require to create an EFM role as we need to fire create role query by connecting to DB.

Deploy

Once you have supplied all these fields save input file and exit from it.

Run the following command to start setting up EFM cluster

terraform init

terraform apply

This will prompt you to confirm the creation of cluster. Type yes and hit enter to proceed. Once finished you can see resource created messages on your terminal.

Create a PEM monitoring server

Introduction

Pem monitoring server is used to monitor DB servers. In this document, we will walk you through steps of creating PEM monitoring server

Prerequisite

  • Terraform installed on your machine
  • Ansible installed on your machine.
  • Vmware vsphere access rights
  • Centos-7 Template created with GNOME configured
  • Subscription for EDB yum repository.

Installation & Configuration

Download the terraform input file from the git repository. The file will download in the folder. Go inside that folder and edit the file using your favorite editor.

Each field has its description commented out.

  • EDB_yumrepo_username
  • EDB_yumrepo_password
  • dcname
  • ssh_user
  • ssh_password
  • dcname
  • db_password
  • template_name
  • user
  • password
  • vsphere_server
  • cpucore
  • ramsize
  • datastore
  • compute_cluster
  • network

EDB_Yum_Repo_Username and EDB_Yum_Repo_Password

This is a mandatory field. You can register and create

dcname

This is the name of the datacenter in vmware vsphere.

ssh_password

This is a mandatory field. Provide password for the ssh_user.

ssh_user

This is the ssh user name you can provide who will login and configure the cluster. By default username is centos however you can provide user name of your choice. Make sure this user has all the privileges.

db_password

This is the PEM server backend DB password you need to supply. We will install Enterprise Postgresql version 11 as backend database to pemserver.

template_name

Provide name of template create in vmware vsphere.This is base template with centos 7 ISO image and configured with at least one user.

user

Provide username of vmware vsphere user.

password

Provide password of vmware vsphere username

vsphere_server

Provide vmware vsphere server address or URL

datastore

Provide storage name in your datacenter

compute_cluster

Provide a compute cluster name in your datacenter.

network

Provide network name in your datacenter.

Once you fill all the details save this file and exit from it.

Deploy

Run terraform init and then terraform apply command

After this it will prompt you to enter yes. Type yes and hit enter. This will start the process of creating a cluster. If successful it will display IP of newly created server.

Access the PEM server

https://<ip_address_of_PEM_host>:8443/pem

Username: enterprisedb Password: The DB password you entered in db_password field

Register PEM Agent with PEM server

Introduction

To start monitoring DB servers created earlier with PEM monitoring servers we need to register an agent with it. This is pemagent. Following document will explain how we can register a pem agent with a pem server.

Prerequisite

DB cluster created using EDB deployment scripts. PEM server created using EDB deployment scripts.

Installation & Configuration

Download deployment scripts from git repo. This will download a folder where your terraform input file is present. Go inside PEM_Agent_VMWARE directory and open file with .tf extension in your favorite text editor.

Add below fields in the input file.

  • EDB_Yum_Repo_Username
  • EDB_Yum_Repo_Password
  • ssh_user
  • ssh_passsord
  • db_user
  • db_password
  • pem_web_ui_password.

EDB_Yum_Repo_Username & EDB_Yum_Repo_Password

This is EDB yum repository credentials you need to pass if you are using the community version of postgresql that is pg10, pg11, pg12

ssh_user

Provide ssh username who is going to perform this activity.

ssh_password

This is a password for ssh_user.

db_user

This is a DB username. Provide DB username if you have changed from default username.

db_password

This is the DB password of a remote server.

pem_web_ui_password.

This is a pem monitoring server DB password. Same we are using for login to UI of pem server.

Once you are done with editing the file save it and exit from it.

Deploy

Run below command to start process of registering pem agent with pem server

terraform init

terraform apply

This will prompt you to enter yes. Type yes and hit enter. This will start the process of registering a pem agent with the pem server and in last you will see a resource added message on the display.

Scale up the DB Cluster

Introduction

We are providing this option to expand your existing DB cluster. This option will not only expand DB cluster but also register newly created instances with pem server and add it to EFM cluster. In addition we are providing an option to create mixed mode replication type here. Which means now you can add a new server in the existing cluster with synchronous mode. Please note select option synchronous only if your existing cluster is in asynchronous mode.

Prerequisite

  • DB Cluster set up using EDB deployment scripts.
  • PEM server created using EDB deployment scripts.
  • EFM set up using EDB deployment scripts.
  • Vmware vsphere access rights
  • Centos-7 Template created with GNOME configured
  • Subscription for EDB yum repository(If using EDB Postgres)

Installation & Configuration

Download deployment scripts from git repository. A folder will download having a terraform input file. Go inside Expand_DB_Cluster_VMWARE directory and open file with .tf extension in your favorite text editor.

Add below fields in the input file.

  • EDB_yumrepo_username
  • EDB_yumrepo_password
  • dcname
  • ssh_user
  • ssh_password
  • replication_type
  • replication_password
  • db_user
  • notification_email_address
  • efm_role_password
  • pem_web_ui_password
  • db_password
  • cpucore
  • ramsize
  • template_name
  • user
  • password
  • vsphere_server
  • datastore
  • compute_cluster
  • network

dcname

This is vmware vsphere datacenter name.

ssh_user

Provide ssh username who is going to perform this activity.

ssh_password

This is a password for ssh_user.

replicationpassword

We are creating 3 node clusters with replication set up among those. This field will set a replication password for replication role edbrepuser, which we are creating on your behalf and assigning the password of your choice.

EDB_yumrepo_username

If you have selected Enterprise PostgreSQL as your DB engine, you need to provide this field.

EDB_yumrepo_password

This is a yum repo user password.

replicationtype

This field will ask you to select replication type, synchronous or asynchronous. Make sure if you have selected synchronous replication type in 3 node DB cluster set up leave this field blank.

dbuser

If you decide to not use default DB username(for Postgresql its postgres and for Enterprise Postgresql its enterprisedb) you can provide the name of dbuser here. We will create a user from this field and assign default password postgres(which you can change later).

notification_email_address

Provide an email address where you will receive a notification related to your EFM cluster operation.

efm_role_password

We are creating a separate DB role for EFM operation called edbefm and assigning permission to perform operations required in failover management. In this field, you need to provide a password for this role.

dbpassword

This is the DB password of a remote server.

pem_web_ui_password.

This is a pem monitoring server DB password. Same we are using for login to UI of pem sever.

template_name

Provide name of template created in vmware vsphere.This is base template with centos 7 ISO image and configured with at least one user.

user

Provide username of vmware vsphere user.

password

Provide password of vmware vsphere username

vsphere_server

Provide vmware vsphere server address or URL

datastore

Provide storage name in your datacenter

compute_cluster

Provide a compute cluster name in your datacenter.

network

Provide network name in your datacenter.

Deploy

Once you are done with editing the file save it and exit from it.

Run below command to start process of registering pem agent with pem server

terraform init

terraform apply

This will prompt you to enter yes to create the resource. Type yes and hit the enter key. This will start the process of creating and configuring the DB cluster.

Clone this wiki locally