-
Notifications
You must be signed in to change notification settings - Fork 40
VMware Vsphere
This document will take you through steps of creating and configuring the database cluster ( 3 nodes, 1 Master and 2 standby ) in the vphere available to you. 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 AMI for the creation of an instance.
- 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)
You can install terraform by following the instruction here. We have tested with terraform version 0.12.18
You can install Ansible by the following the instruction here
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
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
- dbengine
- replication_type
- replication_password
- db_user
- db_password
- cpucore
- ramsize
- template_name
- user
- password
- vsphere_server
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.
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 optional ssh user name you can provide who will login and configure the EFM cluster. Please note this user must log in with the key pair provided in the ssh_key_path field. By default, it is a centos user.
dbengine We are providing an option to select different DB engines and create a cluster with it. These DB engines are as follows.
- 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. Once you edit a file and supplied mandatory fields save this file and exit from it.
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 the password of vmware vsphere username
vsphere_server Provide vmware vsphere server address or URL
Run the following command to start running terraform config file. Make sure you are in the same directory where the 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.
In this document, we will walk you through steps of setting up EFM on the cluster which was created earlier.
The DB cluster for which EFM we are going to set must have been created using EDB terraform config file of the DB cluster setup with replication.
Download the terraform input file from the git repository. This will download the directory. Go inside that 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
- ssh_user
- dbengine
- 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.
ssh_user This is the optional ssh user name you can provide who will login and configure the EFM cluster. By default it is centos. By default, it is a centos user.
dbengine This is a mandatory field you need to supply before running a terraform config file.
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.
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.
Pem monitoring server is used to monitor DB servers. In this document, we will walk you through steps of creating PEM monitoring server
- 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(If using EDB Postgres)
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
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 optional ssh user name you can provide who will login and configure the EFM cluster. Please note this user must log in with the key pair provided in the ssh_key_path field. By default, it is a centos user.
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 the 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
Once you fill all the details save this file and exit from it.
Run the following commands
terraform init
terraform apply
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 the newly created server.
https://<ip_address_of_PEM_host>:8443/pem
Username: enterprisedb
Password: The DB password you entered in db_password field
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.
- DB cluster created using terraform config file.
- PEM server created with terraform config file.
Download terraform config file from git repo. This will download a folder where your terraform input file is present. Go inside this directory and open file with .tf extension with your favorite text editor.
Add below fields in the input file.
- EDB_Yum_Repo_Username
- EDB_Yum_Repo_Password
- ssh_user
- ssh_passsord
- dbengine
- 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 password for ssh_user.
dbengine This is the DB engine(pg10,pg11,pg12,eps10,epas11,epas12) of a remote server.
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 sever. Once you are done with editing the file save it and exit from it.
Run below command to start the 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.
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 a mixed-mode replication type here. This 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.
- DB Cluster set up using EDB terraform config file
- PEM server created using EDB terraform config file
- Vmware vsphere access rights
- Centos-7 Template created with GNOME configured
- Subscription for EDB yum repository(If using EDB Postgres)
Download terraform input file from git repository. A folder will download having a terraform input file. Go inside this directory and open file with .tf extension with your favorite text editor.
Add the below fields in the input file.
- EDB_yumrepo_username
- EDB_yumrepo_password
- dcname
- ssh_user
- ssh_password
- dbengine
- 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
dcname This is vmware vsphere datacenter name.
ssh_user Provide ssh username who is going to perform this activity.
ssh_password This is password for ssh_user.
dbengine We are providing an option to select different DB engines and create a cluster with it. These DB engines are as follows.
-
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
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. By default, this is asynchronous which means if you leave this field blank cluster will create with asynchronous replication type.
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 operation require in failover management. In this field, you need to provide 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 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 the password of VMWare vsphere username
vsphere_server Provide VMWare vsphere server address or URL
Once you are done with editing the file save it and exit from it. Run below command to start the 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.