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.
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:
- Use apt command to install PostgreSQL
sudo apt-get install postgresql
- 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.
- Edit /etc/postgresql/8.4/main/pg_hba.conf. Setting the privilege to let cc can connect to data base.
- Restart postgresql service
sudo /etc/init.d/postgresql-8.4 restart
- 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
- You can see the command line prefix become template1=#. Use below command to change password.
\password {new password}
- 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}
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}
留言