Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store MySQL's data directory in /var/ramfs #888

Closed
edmorley opened this issue Aug 23, 2017 · 0 comments
Closed

Store MySQL's data directory in /var/ramfs #888

edmorley opened this issue Aug 23, 2017 · 0 comments

Comments

@edmorley
Copy link
Contributor

If /var/ramfs exists, the postgresql cookbook copies the existing Postgresql data directory to it, and then updates data_directory to use the new location:

if [ -d /var/ramfs ]; then
# Copy initial databases to RAMFS
for data_dir in /var/lib/postgresql/*; do
v=$(basename $data_dir)
if [ -d $(dirname /var/ramfs/postgresql) -a ! -d /var/ramfs/postgresql/$v ]; then
mkdir -p /var/ramfs/postgresql/$v
cp -rp $data_dir /var/ramfs/postgresql/
fi
done
fi

<% if ::File.directory?('/var/ramfs') -%>
data_directory = '/var/ramfs/postgresql/9.6/main' # use data in another directory
<% else -%>
data_directory = '/var/lib/postgresql/9.6/main' # use data in another directory
<% end -%>

It would be great to do something similar for MySQL, since doing so manually (using the steps here) made our unit tests run twice as fast.

This would presumably mean:

  1. Copying the contents of /var/lib/mysql/ to /var/ramfs/mysql/ in a similar manner to what initd_postgresql.erb does.
  2. Overriding the MySQL datadir option via an extra /etc/mysql/conf.d/ config file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@edmorley @bogdanap and others