Skip to content

Increase PostgreSQL Database storage

kuanfandevops edited this page Oct 10, 2017 · 24 revisions

The current configuration

Storage:

postgresql:  Bound to volume app-pv-152-1g	1 GiB  

postgresql deployment configuration:

    spec:
	template:
		spec:
		  volumes:
			- name: postgresql-data
			  persistentVolumeClaim:
				claimName: postgresql
	containers:
		  volumeMounts:
			- name: postgresql-data
			  mountPath: /var/lib/pgsql/data				

Instructions to increase database storage

step1: send out the notification to end user if necessary

step2: backup current database
Use oc command login OpehShift
Switch to project moe-gwells-
Run command 'oc get pods' to get all pods and find the active PostgreSQL pod, it should be named like postgresql-42-t01rv
Run command 'oc rsync :/var/lib/pgsql/data . This command should copy everything under /var/lib/pgsql/data to local directory
Run command 'oc rsh ' to rsh to the pod and verify if the data has been all copied to load directory, especially the hidden files.

step3. create a new storage for 5GiB

postgresql2:  Bound to volume <new storage name>	5GiB			  

step4. update postgresql deployment configuration to mount current storage claim to postgresql-data-old and mount new storage claim to postgresql-data:

    spec:
	template:
		spec:
		  volumes:
			- name: postgresql-data
			  persistentVolumeClaim:
				claimName: postgresql2
			- name: postgresql-data-old
			  persistentVolumeClaim:
				claimName: postgresql
	containers:
		  volumeMounts:
			- name: postgresql-data
			  mountPath: /var/lib/pgsql/data				
			- name: postgresql-data-old
			  mountPath: /var/lib/pgsql/data-old

step5: verify if a new deployment for postgresql has happened, manually trigger one if not

step6: login to pod and copy data under /var/lib/pgsql/data-old to /var/lib/pgsql/data

step7: update postgresql deployment configuration to remove postgresql-data-old:

    spec:
	template:
		spec:
		  volumes:
			- name: postgresql-data
			  persistentVolumeClaim:
				claimName: postgresql2
	containers:
		  volumeMounts:
			- name: postgresql-data
			  mountPath: /var/lib/pgsql/data				

step8: verify if a new deployment for postgresql has happened, manually trigger one if not

step9: verify if application works properly

Further consideration

make sure a site maintenance page is displayed before we run the storage

Clone this wiki locally