Move the QuerySurge™ Database Data Directory (Linux)
- Make sure all users are out of the system and that no executions are running.
- For the following steps, log into each QuerySurge deployment box with administrative privileges.
- Stop all of the QuerySurge services.
- [sudo] service QuerySurge stop
Note: While a database shutdown from the Windows Services console almost always leaves the data files intact, it is safer to use the "slow shutdown" procedure, which is described in our article QuerySurge Database Backup Procedures; see the section "Notes on QuerySurge Backups".
- In your QuerySurge installation directory, find the mysql directory (/<QuerySurge Install Dir>/QuerySurge/mysql).
- In this directory, find the my.cnf file. Make a backup copy of this file.
- Edit the my.cnf file with your preferred editor, such as vi.
- Search the file for: datadir. The default entry is:
- Edit this file carefully. Modify the datadir entry to the new data directory, where you will be moving your database files. In the following example, we have modified the datadir entry for a directory on /var/opt:
- Continuing with this example, create a QuerySurge directory under /var/opt. Under the QuerySurge directory, create a data directory by copying the entire data directory from your current installation directory (default is /opt/QuerySurge/mysql/data).
- Start the QuerySurge MySQL service
- [sudo] service QuerySurge start mysql
If you have not edited the my.cnf file correctly, the database should not start. If the database fails to start, check and fix your edits and try starting the database again.
If you cannot start the database, revert back to your copy of my.cnf (from step 5), and start your database. Contact QuerySurge support. (You can create a helpdesk ticket from within QuerySurge itself, or on the QuerySurge website, www.querysurge.com.)
- Once the database has started, start the remaining QuerySurge services in the following order:
- [sudo] service QuerySurge start tomcat
- [sudo] service QuerySurge start agent
- [sudo] service QuerySurge start statsmon
Log in to QuerySurge as a final check. Your QuerySurge database data directory should now be changed to the value you entered for datadir in my.cnf.
Note: If you are moving your QuerySurge database data directory to another disk location because of disk space concerns, it may make sense to move the database tmp directory as well. See this article for details.