It can be advantageous to move the directory on the supervisor which contains the SQL databases database files from the root volume or C: drive to a filesystem on a separate physical disk that is dedicated to the SQL databasesdedicated disk. This should be a separate physical disk, not just another partition on the same disk as other partitions, otherwise you'll get almost no benefit.
...
- Be logged into the Supervisor as the root user
- Stop the Supervisor service: /etc/init.d/
service supervisor stop
- Stop the mysql postgresql server: /etc/init.d/mysqld
service postgresql-pfx stop
- Copy the current datadir over to the new location ensuring that you preserve ownership and permissions:
cp -rP /
varusr/
liblocal/
mysqlpfx/pgsql/data /newpath/
mysqlpgsql/data
- Rename the current datadir so that it won't be found by mistake, but leave it in place so you have a fallback plan:
mv /
varlusr/
liblocal/
mysqlpfx/
varpgsql/
lib/mysqldata /usr/local/pfx/pgsql/data.MOVED
- Edit the /etc/my.cnf, copy the
datadir
line, comment out the original as a backup (part 2 of the fallback plan), and edit the uncommented line to point to the new location - Start the mysql server: /etc/init.d/mysqld Make a backup copy of the startup script, /usr/local/pfx/qube/utils/pgsql/startdb.sh , then edit it by changing the PGSQL_DATA_DIR to point to the new data directory.
Optionally, you may also want to change the PGSQL_LOG to point to a new log location. - Make a backup copy of the stop script, /usr/local/pfx/qube/utils/pgsql/stop.sh , then edit it by changing the PGSQL_DATA_DIR to point to the new data directory.
- Start the postgresql server:
service postgresql-pfx start
- Check that the new datadir is the one being used:
mysql -u root -e "SHOW variables like 'datadir'"
...
/usr/local/pfx/pgsql/bin/psql -p 50055 -U pfx -d pfx -c "SHOW data_directory"
If it looks good, start the Supervisor service:
service supervisor start
Mac
- Run the following commands in a terminal.
Stop the Supervisor service:
sudo launchctl stop com.pipelinefx.supervisor- Stop the postgresql server:
sudo launchctl stop com.pipelinefx.postgresql
- Copy the current datadir over to the new location ensuring that you preserve ownership and permissions:
sudo cp -rP /Applications/pfx/pgsql/data /newpath/pgsql/data
- Rename the current datadir so that it won't be found by mistake, but leave it in place so you have a fallback plan:
sudo mv /Applications/pfx/pgsql/data /Applications/pfx/pgsql/data.MOVED
- Make a backup copy of the launchd plist file,
/Library/LaunchDaemons/com.pipelinefx.postgresql.plist
, then edit it by changing/Applications/pfx/pgsql/data
to the new data directory.
Optionally, you may also want to change/Applications/pfx/pgsql/pgsql.log
to new log location. - Start the postgresql server:
sudo launchctl start com.pipelinefx.postgresql - Check that the new datadir is the one being used:
/Applications/pfx/pgsql/bin/psql -p 50055 -U pfx -d pfx -c "SHOW data_directory"
If it looks good, start the Supervisor service:
...
- sudo launchctl start com.pipelinefx.supervisor
Windows
- stop the qubesupervisor service
- stop the pfxmysql service postgresql-pfx service
- move the C:\Program Files\pfx\qubepgsql\mysql\data directory to the new directory, e.g., D:\qube\dataedit
- run the following command on a command prompt to first unregister the postgresql-pfx service:
"C:\Program Files\
pfqpfx\
qubepgsql\
mysql\my.cnf, change the datadir value to point to Dbin\pg_ctl" unregsiter -N postgresql-pfx
- run the following command (substitute the data directory, "D:\qube\data") to register the postgresql-pfx service with the new directory:
"C:\Program Files\pfx\pgsql\bin\pg_ctl" regsiter -N postgresql-pfx -S auto -U pfx -P Qub3!R0x! -D D:\qube\data
start the pfxmysql ("Qub3!R0x!" is the default password for the pfx user-- substitute appropriately, if you've changed it) - start the postgresql-pfx service
- test that the mysql PostgreSQL server sees the databases database in their its new location by running:
mysql -u root -e "SHOW DATABASES"
It should return a list of databases which include some with the word "qube" in the name"C:\Program Files\pfx\psql" -p 50055 -U pfx -d pfx -c "SHOW data_directory".
- start the qubesupervisor service
...