【spark】hadoop-spark集群搭建
hadoop-spark集群搭建
下载hadoop
http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.8.2/hadoop-2.8.2.tar.gz
下载的我放在桌面的:desktop
cp /home/hserver1/desktop/hadoop-2.8.2.tar.gz /opt
tar -xvf hadoop-2.8.2.tar.gz
新建目录
mkdir /root/hadoop
mkdir /root/hadoop/tmp
mkdir /root/hadoop/var
mkdir /root/hadoop/dfs
mkdir /root/hadoop/dfs/name
mkdir /root/hadoop/dfs/data
修改etc/hadoop
修改core-site.xml
gedit /opt/hadoop-2.8.2/etc/hadoop/core-site.xml
<configuration>节点内加入配置
hserver1如果是hserver2就要修改这里
<property>
<name>hadoop.tmp.dir</name>
<value>/root/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://hserver1:9000</value>
</property>
修改hadoop-env.sh
gedit hadoop-2.8.2/etc/hadoop/hadoop-env.sh
修改export JAVA_HOME
export JAVA_HOME=/opt/jdk1.8.0_152
修改hdfs-site.xml
gedit hadoop-2.8.2/etc/hadoop/hdfs-site.xml
加入配置
<property>
<name>dfs.name.dir</name>
<value>/root/hadoop/dfs/name</value>
<description>Path on the local filesystem where theNameNode stores the namespace and transactions logs persistently.</description>
</property>
<property>
<name>dfs.data.dir</name>
<value>/root/hadoop/dfs/data</value>
<description>Comma separated list of paths on the localfilesystem of a DataNode where it should store its blocks.</description>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.permissions</name>
<value>true</value>
<description>need not permissions</description>
</property>
新建并且修改mapred-site.xml
cd /opt/hadoop-2.8.2/etc/hadoop
cp mapred-site.xml.template mapred-site.xml
gedit /opt/hadoop-2.8.2/etc/hadoop/mapred-site.xml
加入配置
hserver1如果是hserver2就要修改这里
<property>
<name>mapred.job.tracker</name>
<value>hserver1:49001</value>
</property>
<property>
<name>mapred.local.dir</name>
<value>/root/hadoop/var</value>
</property>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
修改slaves文件
gedit /opt/hadoop-2.8.2/etc/hadoop/slaves
修改yarn-site.xml文件
gedit /opt/hadoop-2.8.2/etc/hadoop/yarn-site.xml
加入配置
hserver1如果是hserver2就要修改这里
<property>
<name>yarn.resourcemanager.hostname</name>
<value>hserver1</value>
</property>
<property>
<description>The address of the applications manager interface in the RM.</description>
<name>yarn.resourcemanager.address</name>
<value>${yarn.resourcemanager.hostname}:8032</value>
</property>
<property>
<description>The address of the scheduler interface.</description>
<name>yarn.resourcemanager.scheduler.address</name>
<value>${yarn.resourcemanager.hostname}:8030</value>
</property>
<property>
<description>The http address of the RM web application.</description>
<name>yarn.resourcemanager.webapp.address</name>
<value>${yarn.resourcemanager.hostname}:8088</value>
</property>
<property>
<description>The https adddress of the RM web application.</description>
<name>yarn.resourcemanager.webapp.https.address</name>
<value>${yarn.resourcemanager.hostname}:8090</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>${yarn.resourcemanager.hostname}:8031</value>
</property>
<property>
<description>The address of the RM admin interface.</description>
<name>yarn.resourcemanager.admin.address</name>
<value>${yarn.resourcemanager.hostname}:8033</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>2048</value>
<discription>每个节点可用内存,单位MB,默认8182MB</discription>
</property>
<property>
<name>yarn.nodemanager.vmem-pmem-ratio</name>
<value>2.1</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>2048</value>
</property>
<property>
<name>yarn.nodemanager.vmem-check-enabled</name>
<value>false</value>
</property>
http://blog.csdn.net/pucao_cug/article/details/71698903
启动
hadoop集群
cd /opt/hadoop-2.8.2/bin
./hadoop namenode -format
cd /opt/hadoop-2.8.2/sbin
./start-all.sh
http://169.254.254.11:50070
http://169.254.254.11:8088