Created
August 18, 2014 11:11
-
-
Save hanabokuro/d88b636c82d50ab3a4d0 to your computer and use it in GitHub Desktop.
vagrantfile for apache storm - * not work yet *
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
VAGRANTFILE_API_VERSION = "2" | |
SERVERS = [ | |
{ hostname: "storm", ssh_forward: 2302, networks: [ { ip: "192.168.0.2", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "nimbus", ssh_forward: 2303, networks: [ { ip: "192.168.0.3", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server1", ssh_forward: 2304, networks: [ { ip: "192.168.0.4", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server2", ssh_forward: 2305, networks: [ { ip: "192.168.0.5", virtualbox__intnet: "storm" } ] }, | |
{ hostname: "server3", ssh_forward: 2306, networks: [ { ip: "192.168.0.6", virtualbox__intnet: "storm" } ] }, | |
] | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "chef/centos-6.5" | |
SERVERS.each do |server| | |
config.vm.define server[:hostname] do |v| | |
v.vm.hostname = server[:hostname] | |
server[:networks].each do |network| | |
v.vm.network :private_network, network | |
v.vm.network :forwarded_port, id: "ssh", guest: 22, host: server[:ssh_forward] | |
end | |
end | |
config.vm.provision :shell, inline: <<END | |
if ! grep #{server[:hostname]} /etc/hosts > /dev/null ; then echo "#{server[:hostname]} #{server[:networks][0][:ip]}" >> /etc/hosts ; fi | |
END | |
end | |
config.vm.provision :shell, inline: <<END | |
wget -nv http://public-repo-1.hortonworks.com/HDP/centos5/2.x/GA/2.1-latest/hdp.repo -O /etc/yum.repos.d/hdp.repo | |
END | |
config.vm.define "storm" do |v| | |
v.vm.provision :shell, inline: <<END | |
yum install -y storm | |
END | |
end | |
["server1", "server2", "server3"].each do |hostname| | |
no = %r!(\d+)!.match("server1")[1] | |
config.vm.define hostname do |v| | |
v.vm.provision :shell, inline: <<END | |
yum install -y zookeeper | |
if [ ! -d hdp_manual_install_rpm_helper_files-2.1.2.471 ] ; then | |
wget http://public-repo-1.hortonworks.com/HDP/tools/2.1.2.1/hdp_manual_install_rpm_helper_files-2.1.2.471.tar.gz | |
tar xvzf hdp_manual_install_rpm_helper_files-2.1.2.471.tar.gz | |
fi | |
. hdp_manual_install_rpm_helper_files-2.1.2.471/scripts/directories.sh | |
. hdp_manual_install_rpm_helper_files-2.1.2.471/scripts/usersAndGroups.sh | |
ZOOKEEPER_DATA_DIR=/var/zookeeper-data-dir | |
mkdir -p $ZOOKEEPER_LOG_DIR; | |
chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_LOG_DIR; | |
chmod -R 755 $ZOOKEEPER_LOG_DIR; | |
mkdir -p $ZOOKEEPER_PID_DIR; | |
chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_PID_DIR; | |
chmod -R 755 $ZOOKEEPER_PID_DIR; | |
mkdir -p $ZOOKEEPER_DATA_DIR; | |
chmod -R 755 $ZOOKEEPER_DATA_DIR; | |
chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_DATA_DIR | |
echo #{no} > $ZOOKEEPER_DATA_DIR/myid | |
rm -r $ZOOKEEPER_CONF_DIR ; | |
mkdir -p $ZOOKEEPER_CONF_DIR ; | |
cat <<END_CONF > $ZOOKEEPER_CONF_DIR/zoo.cfg | |
# The number of milliseconds of each tick | |
tickTime=2000 | |
# The number of ticks that the initial | |
# synchronization phase can take | |
initLimit=10 | |
# The number of ticks that can pass between | |
# sending a request and getting an acknowledgement | |
syncLimit=5 | |
# the directory where the snapshot is stored. | |
dataDir=$ZOOKEEPER_DATA_DIR | |
# the port at which the clients will connect | |
clientPort=2181 | |
server.1=server1:2888:3888 | |
server.2=server2:2888:3888 | |
server.3=server3:2888:3888 | |
END_CONF | |
chmod a+x $ZOOKEEPER_CONF_DIR/; | |
chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_CONF_DIR/../ ; | |
chmod -R 755 $ZOOKEEPER_CONF_DIR/../ | |
END | |
end | |
end | |
end | |
__END__ | |
* start zookeepr | |
su - zookeeper -c 'source /etc/zookeeper/conf/zookeeper-env.sh ; export | |
ZOOCFGDIR=/etc/zookeeper/conf;/usr/lib/zookeeper/bin/zkServer.sh start >> /var/log/zookeeper/zoo.out 2>&1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment