Facebooktwittergoogle_plusredditpinterestlinkedin

Hi Everyone,

Today I had to create a script to move the PostgreSQL data and configuration files to a different device or hard drive on Ubuntu Linux. The purpose of this post is to share the results with you.

Moving PostgreSQL files to a separate device or drive has a couple of benefits:

  1. You can optimize your new drive for its intended purpose. In our case, we are creating a database storage drive.
  2. You can help ensure the durability of your data. If you host ADempiere or iDempiere using Amazon’s AWS, you can move your sensitive database files to an EBS device. Doing so helps ensure that your data will survive an EC2 crash or shutdown.

Here is the commands I used. Look below for a shortcut script.

sudo apt-get update
sudo updatedb
sudo apt-get install -y xfsprogs postgresql
sudo mkfs.ext4 /dev/xvdb
echo "/dev/xvdb /vol ext4 noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir -m 000 /vol
sudo mount /vol
sudo -u postgres service postgresql stop
#map the data direcory
sudo mkdir /vol/var
sudo mv /var/lib/postgresql/9.1/main /vol/var
sudo mkdir /var/lib/postgresql/9.1/main
echo "/vol/var/main /var/lib/postgresql/9.1/main none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/postgresql/9.1/main
#map the conf directory
sudo mkdir /vol/etc
sudo mv /etc/postgresql/9.1/main /vol/etc
sudo mkdir /etc/postgresql/9.1/main
echo "/vol/etc/main /etc/postgresql/9.1/main none bind" | sudo tee -a /etc/fstab
sudo mount /etc/postgresql/9.1/main
sudo -u postgres service postgresql start

The above section assumes that PostgreSQL is already installed (sudo apt-get install -y postgresql). Note that Ubuntu changes the name of the device from ‘sdc’ to ‘xvdc’ or s.. to xv…

If you want to make things really easy, just copy and paste the below command to your system:

wget https://s3.amazonaws.com/ChuckSteak/aws_idempiere_move_postgresql_to_ebs.sh; chmod 766 aws_idempiere_move_postgresql_to_ebs.sh; ./aws_idempiere_move_postgresql_to_ebs.sh xvdd

Note: set the last parameter to your device name (xvdd in my case). If you want to test if the process was successful, do the following

  1. sudo nano /vol/etc/main/postgresql.conf
  2. Edit the first commented line by adding your initials to the end.
  3. Save and close
  4. sudo nano /etc/postgresql/9.1/main/postgresql.conf
  5. If you were successful, you should see your initials since both directories point to the same physical location.

I hope this helps!!

Special thanks goes out to Eric Hammond for providing the inspiration. If you have not read this article, it is worth reading.

Why consider Open Source ERP

Open source ERP gives you every opportunity to prove or disprove its ability to support your company’s ERP needs on a timeline that satisfies your organizational needs. With open source ERP, you do not face the same financial constraints nor do you face the same conflicts of interest as with commercial ERP. Instead, you invest in the appropriate skills and knowledge for your people and processes. Best of all – if open source ERP cannot solve your company’s needs, you can safely justify spending the additional $2K to $5K per person per year for life of your commercial ERP to help drive your organization’s success.

ADempiere vs iDempiere vs Openbravo vs Compiere

Please note that ADempiere, iDempiere and Openbravo are forks or copies from Compiere. Therefore, they have similar abilities mentioned above. The biggest difference is that ADempiere and iDempiere are pure open source. There are no features held behind a commercial or paid license.

About Chuck Boecking: I am an ERP educator. I believe that open source ERP have achieved mainstream capabilities, and as a result, more companies can create greater efficiency across their organization. I started using the iDempiere code base in 2003. Back then, it was called Compiere. In 2006, I started my first multi-million dollar installation. Since then, ADempiere has helped me create great success with distribution and manufacturing companies all over the world. My vision of success is to find companies that can best use open source ERP to help them achieve a single, global instance that drives a discontinuous increase in profitability. I believe that organizations win when they own their technology.

If you have questions, comments or concerns, let me know. I definitely want your feedback.

You can contact me by phone using 512.850.6068.

My email is chuck@chuboe.com.

You can complete the form on this page.

Thank you for taking the time. I look forward to speaking with you.

Regards,
Chuck Boecking
http://www.linkedin.com/pub/chuck-boecking/10/970/17b

 

Facebooktwittergoogle_plusredditpinterestlinkedin

Leave a Reply

Your email address will not be published. Required fields are marked *