本文介绍在2个节点上安装配置HadoopDB方法。各节点的名称分别为Cluster01(192.168.0.1),Cluster02(192.168.0.2)。
以下若是用 hadoop@Cluster0X:~ 代表 Cluster01 ~ Cluster02 都要做的.
参考资料1:HadoopDB Quick Start Guide
参考资料2:HadoopDB安装使用
1 首先在各节点上安装Hadoop-0.20.2, 参考此文 。
2 各节点安裝设置 PostgreSQL:
- 安裝并为数据库建立 hadoop 帐号,假定使用密碼为 1234
- hadoop@Cluster0X:~$ sudo apt-get install postgresql
- hadoop@Cluster0X:~$ sudo vim /etc/postgresql/8.4/main/pg_hba.conf
- #local all all ident
local all all trust
# IPv4 local connections:
#host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 password
host all all 192.168.0.1/24 password # 加上Cluster 機器 IP 範圍
# IPv6 local connections:
#host all all ::1/128 md5
host all all ::1/128 password
- #local all all ident
- hadoop@Cluster0X:~$ sudo /etc/init.d/postgresql-8.4 restart
- hadoop@Cluster0X:~$ sudo su - postgres
- postgres@Cluster0X:~$ createuser hadoop
- Shall the new role be a superuser? (y/n) y
postgres@Cluster01:~$ psql
psql (8.4.2)
Type "help" for help.
postgres=# alter user hadoop with password '1234';
ALTER ROLE
postgres=# /q
- Shall the new role be a superuser? (y/n) y
- 測試其他機器可否連線
- hadoop@Cluster01:~$ createdb testdb
- hadoop@Cluster02:~$ psql -h Cluster01 testdb
- 如果能够连接上,则出现以下提示:
- 口令:
psql (8.4.2)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
testdb=#
- 口令:
- 如果能够连接上,则出现以下提示: