How to update the host ip of DevPortal database

Not applicable

Could anyone please answer to the question on DevPortal for Private Cloud?

As for updating the IP address of existing MySQL Database specified in the file;

/var/www/html/sites/default/settings.php

with the parameter 'host' of $databases array, can we take either or both of the following procedures?

  • Opt-1: service httpd stop -> update the setting.php -> service httpd start
  • Opt-2: drush vset maintenance_mode 1 -> update the setting.php -> drush vset maintenance_mode 0

Other than this do we also need to fllow the steps;

Go to {{site_url}}/update.php, where {{site_url}} is your site URL and follow instructions on screen.

You will need to be logged in as an administrator.

Solved Solved
0 5 266
1 ACCEPTED SOLUTION

Dear @Toshihiro Shibamoto ,

You don't need to start / stop http server or even put the site in maintenance mode. Settings are dynamically read during run time. So , I will suggest following approach.

  • Take a backup of settings.php file
  • Make changes & save the file.

I don't think you will see any downtime. It will be split second. The moment you save the file, developer portal will start serving from new database. That's it.

You will run update.php if any upgrades are available for modules / entire site. Since the codebase is same i don't think you need to run update.php.

PS: Above solution will work if a developer portal database exists in new ip address. Otherwise developer portal will break or will ask for re-installation. Make sure you have populated database in new ip address.

If your developer portal is up & running in production environement then i would suggest below approach to prevent data loss.

  • Put site in Maintenance Mode.
  • Take a backup of existing database.
  • Move the database to new ip location using the backup taken in above step.
  • Take the backup of settings.php
  • Change the settings in settings.php to point to new location.
  • Disable Maintenance Mode.

You can also stop your server , but it will result in 500 server not found error. Maintenance mode is good to go considering user experience.

Keep us posted if you see any issues.

Cheers,

Anil Sagar

View solution in original post

5 REPLIES 5

Dear @Toshihiro Shibamoto ,

You don't need to start / stop http server or even put the site in maintenance mode. Settings are dynamically read during run time. So , I will suggest following approach.

  • Take a backup of settings.php file
  • Make changes & save the file.

I don't think you will see any downtime. It will be split second. The moment you save the file, developer portal will start serving from new database. That's it.

You will run update.php if any upgrades are available for modules / entire site. Since the codebase is same i don't think you need to run update.php.

PS: Above solution will work if a developer portal database exists in new ip address. Otherwise developer portal will break or will ask for re-installation. Make sure you have populated database in new ip address.

If your developer portal is up & running in production environement then i would suggest below approach to prevent data loss.

  • Put site in Maintenance Mode.
  • Take a backup of existing database.
  • Move the database to new ip location using the backup taken in above step.
  • Take the backup of settings.php
  • Change the settings in settings.php to point to new location.
  • Disable Maintenance Mode.

You can also stop your server , but it will result in 500 server not found error. Maintenance mode is good to go considering user experience.

Keep us posted if you see any issues.

Cheers,

Anil Sagar

Hello @Anil Sagar , Thank you so much for the answers that really help us.

I understood your case as for setting up new database separately with all the data copied beforehand. Or can we use existing database only with the change in ip address on the host and rebooting it with a new one. Then isn't there any timing issue or data loss between the two changes?

In considering this should we start/stop httpd for the safety to avoid updating data?

And then is there any chance that we can use drush vset maintenance_mode if it works?

Regards,

Toshi

Dear @Toshihiro Shibamoto ,

Yes, You are right. If your developer portal is up & running in production environement then i would suggest below approach to prevent data loss.

  • Put site in Maintenance Mode.
  • Take a backup of existing database.
  • Move the database to new ip location using the backup taken in above step.
  • Take the backup of settings.php
  • Change the settings in settings.php to point to new location.
  • Disable Maintenance Mode.

You can also stop your server , but it will result in 500 server not found error. Maintenance mode is good to go considering user experience.

Cheers,

Anil Sagar

Hello @Anil Sagar ,

Thank you so much for the clarification.

This really helps us.

Regards,

Toshi

Anytime 🙂 Keep us posted if you have any queries..