OpenStack with PostgreSQL

I deployed OpenStack on Ubuntu 10.04 LTS. It is also official recommended OS. In official manual, it demonstrated how to use MySQL as data base. And their installation script was too, it will install mysql-server default. Here, I will show how to use PostgreSQL as data base. In my environment, the data base server and cloud controller (cc) are not the same server, they are separeted. In other word, data base is an independent server. So, we must be installation and configuration data base first.
  1. Use apt command to install PostgreSQL
    sudo apt-get install postgresql
  2. After install finish. Open /etc/postgresql/8.4/main/postgresql.conf, and find out lister_addresses. Chang it to correct value depend on your evironment, or you can use "*" to listen all network interface.
  3. Edit /etc/postgresql/8.4/main/pg_hba.conf. Setting the privilege to let cc can connect to data base.
  4. Restart postgresql service
    sudo /etc/init.d/postgresql-8.4 restart
  5. Before create a data base, we need to change default username's password. The default username is postgres, we use below command to into template1 data base.
    sudo -u postgres psql template1
  6. You can see the command line prefix become template1=#. Use below command to change password.
    \password {new password}
  7. Then, you can use \q to exit. Finally, we use below command to create a new data base for cc.
    sudo -u postgres createdb {db name}
Finish installation and configuration PostgreSQL. The next step is install OpenStack compute component. If you want to use script to install it. I have modified official's script, you can download here (nova-CC-installer and nova-NODE-installer). I fixed some errors and change some place, for example: user can chose which data base they used (MySQL or PostgreSQL). This script will not install data base for you. It just let you setting data base's ip address, username and password.

If you install manually. The detail you can refer to official manual. But you need install python-psycopg2 package additional. This package is PostgreSQL driver for python. And in /etc/nova/nova.conf, change --sql_connection flag to like bellow:
--sql_connection=postgresql://{username}:{password}@DATABASE_ADDR/{data base name}

留言

熱門文章