可能大家都遇到过一个问题,集群部署过后如果修改的话,比较麻烦 rsyncd可以解决这个问题,让所有从节点与主节点配置同步
rsyncd是个好东西
【注:这里需要和Hadoop配置目录下得hadoop-env.sh中得rsyncd区分开,如果在hadoop-env中的rsyncd配置相应的值,目的是整个hadoop的同步,适合于在DN中配置,将主节点的hadoop全部同步】
1. lsyncd下载地址
wget
tar -zxvf lsyncd-1.26.tar.gz
cd lsyncd-1.26
./configure make
make install
3. namenode 节点
sudo /usr/local/bin/lsyncd --conf /usr/local/cloudera/lsyncd/etc/lsyncd.conf.xml
4. datanode节点
将rsyncd.conf放到 /etc/rsyncd.conf
sudo rsync --daemon
【================】
lsyncd.conf.xml
<lsyncd version="1">
<settings>
<binary filename="/usr/bin/rsync" />
<pidfile filename="/data/logs/cloudera/lsyncd/lsyncd.pid" />
<callopts>
<option text="-lt%r" />
<option text="--delete" />
<option text="--password-file=/root/www.pass" />
<exclude-file />
<source />
<destination />
</callopts>
</settings>
<!-- hadoop conf目录 -->
<directory>
<source path="/usr/local/cloudera/hadoop-0.20.2-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hadoop-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hadoop-conf" />
</directory>
<!-- hbase conf目录 -->
<directory>
<source path="/usr/local/cloudera/hbase-0.90.3-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hbase-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hbase-conf" />
</directory>
<!-- zookeeper conf目录 -->
<directory>
<source path="/usr/local/cloudera/zookeeper-3.3.3-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::zookeeper-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::zookeeper-conf" />
</directory>
<!-- sqoop conf目录 -->
<directory>
<source path="/usr/local/cloudera/sqoop-1.3.0-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::sqoop-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::sqoop-conf" />
</directory>
<!-- hive conf目录 -->
<directory>
<source path="/usr/local/cloudera/hive-0.7.1-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hive-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hive-conf" />
</directory>
<!-- chukwa conf目录 -->
<directory>
<source path="/usr/local/cloudera/chukwa-0.4.0/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::chukwa-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::chukwa-conf" />
</directory>
<!-- oozie conf目录 -->
<directory>
<source path="/usr/local/cloudera/oozie-2.3.0-cdh3u1/conf/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::oozie-conf" />
<target path="datanode-2-c2.hadoop.maxthon.cn::oozie-conf" />
</directory>
<!-- 所有应用的共享jar目录,启动后jar不会改变 -->
<directory>
<source path="/usr/local/cloudera/share-libs/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hadoop-share-libs" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hadoop-share-libs" />
</directory>
<!-- 所有应用的共享插件目录,开发生成,会经常变动 -->
<directory>
<source path="/usr/local/cloudera/plugins/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hadoop-plugins" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hadoop-plugins" />
</directory>
<!-- lsyncd 的配置文件更改目录 -->
<directory>
<source path="/usr/local/cloudera/lsyncd/" />
<target path="datanode-1-c2.hadoop.maxthon.cn::hadoop-lsyncd" />
<target path="datanode-2-c2.hadoop.maxthon.cn::hadoop-lsyncd" />
</directory>
</lsyncd>
【=========】
pid file = /data/logs/cloudera/lsyncd/rsyncd.pid
lock file = /data/logs/cloudera/lsyncd/rsync.lock
log file = /data/logs/cloudera/lsyncd/rsyncd.log
uid = hadoop
gid = cloud
read only = no
list = yes
#auth users = www
#secrets file = /root/www.pass
[hadoop-conf]
path = /usr/local/cloudera/hadoop-0.20.2-cdh3u1/conf/
[hbase-conf]
path = /usr/local/cloudera/hbase-0.90.3-cdh3u1/conf/
[zookeeper-conf]
path = /usr/local/cloudera/zookeeper-3.3.3-cdh3u1/conf/
[sqoop-conf]
path = /usr/local/cloudera/sqoop-1.3.0-cdh3u1/conf/
[hive-conf]
path = /usr/local/cloudera/hive-0.7.1-cdh3u1/conf/
[chukwa-conf]
uid = chukwa
path = /usr/local/cloudera/chukwa-0.4.0/conf/
[oozie-conf]
path = /usr/local/cloudera/oozie-2.3.0-cdh3u1/conf/
[jobs-conf]
path = /usr/local/cloudera/jobs/
[hadoop-share-libs]
path = /usr/local/cloudera/share-libs/
[hadoop-plugins]
path = /usr/local/cloudera/plugins/
[hadoop-lsyncd]
path = /usr/local/cloudera/lsyncd/