其他分享
首页 > 其他分享> > hadoop部署

hadoop部署

作者:互联网

[root@xiong ~]# hostnamectl set-hostname hadoop001

[root@xiong ~]# vim /etc/hostname
hadoop001

vim /etc/sysconfig/network
# Created by anaconda
NETWORKING_IPV6=no
PEERNTP=no
HOSTNAME=hadoop001

[root@xiong ~]# reboot

[root@hadoop001 ~]# useradd hadoop

[root@hadoop001 ~]# su - hadoop

[hadoop@hadoop001 ~]$ mkdir app

[root@hadoop001 ~]# mkdir /usr/java

[root@hadoop001 ~]# mkdir /usr/share/java -p

[root@hadoop001 app]# tar -xzvf jdk-8u144-linux-x64.tar.gz -C /usr/java

[root@hadoop001 java]# chown -R root:root jdk1.8.0_144

[root@hadoop001 java]# ls -la
total 12
drwxr-xr-x 3 root root 4096 Feb 23 18:49 .
drwxr-xr-x. 14 root root 4096 Feb 23 17:34 ..
drwxr-xr-x 8 root root 4096 Jul 22 2017 jdk1.8.0_144


[root@hadoop001 java]# vim /etc/profile
#env
export JAVA_HOME=/usr/java/jdk1.8.0_144
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JER_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JER_HOME/bin:$PATH

[root@hadoop001 java]# source /etc/profile

[root@hadoop001 java]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

[root@hadoop001 app]# mv hadoop-2.6.0-cdh5.7.0.tar.gz /home/hadoop/app/

[root@hadoop001 app]# su - hadoop

[hadoop@hadoop001 app]$ ls
hadoop-2.6.0-cdh5.7.0.tar.gz

[hadoop@hadoop001 etc]$ vim hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

[hadoop@hadoop001 etc]$ vim hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

[hadoop@hadoop001 etc]$ ssh-keygen

[hadoop@hadoop001 etc]$ cd ~/.ssh/

[hadoop@hadoop001 .ssh]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

[hadoop@hadoop001 .ssh]$ ls -la
total 20
drwx------ 2 hadoop hadoop 4096 Feb 23 19:04 .
drwx------ 4 hadoop hadoop 4096 Feb 23 19:03 ..
-rw-rw-r-- 1 hadoop hadoop 398 Feb 23 19:04 authorized_keys
-rw------- 1 hadoop hadoop 1679 Feb 23 19:03 id_rsa
-rw-r--r-- 1 hadoop hadoop 398 Feb 23 19:03 id_rsa.pub
[hadoop@hadoop001 .ssh]$ chmod 600 authorized_keys
[hadoop@hadoop001 .ssh]$ ls -la
total 20
drwx------ 2 hadoop hadoop 4096 Feb 23 19:04 .
drwx------ 4 hadoop hadoop 4096 Feb 23 19:03 ..
-rw------- 1 hadoop hadoop 398 Feb 23 19:04 authorized_keys
-rw------- 1 hadoop hadoop 1679 Feb 23 19:03 id_rsa
-rw-r--r-- 1 hadoop hadoop 398 Feb 23 19:03 id_rsa.pub

[hadoop@hadoop001 .ssh]$ cd ~/app/hadoop-2.6.0-cdh5.7.0

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ bin/hdfs namenode -format


[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ sbin/start-dfs.sh
19/02/23 19:08:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
localhost: Error: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
ECDSA key fingerprint is SHA256:gjoxsGPX3oqDeiLcTFqMmr7e5YyE6UbM4Qns9Z8FY6E.
ECDSA key fingerprint is MD5:5a:ad:48:61:69:e7:fc:45:c8:4c:4d:66:e0:b7:50:ff.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts.
0.0.0.0: Error: JAVA_HOME is not set and could not be found.
19/02/23 19:09:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ echo $JAVA_HOME
/usr/java/jdk1.8.0_144

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ cd etc/hadoop
[hadoop@hadoop001 hadoop]$ vim hadoop-env.sh
export JAVA_HOME=/usr/java/jdk1.8.0_144


[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ sbin/start-dfs.sh
19/02/23 19:12:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /home/hadoop/app/hadoop-2.6.0-cdh5.7.0/logs/hadoop-hadoop-namenode-hadoop001.out
localhost: starting datanode, logging to /home/hadoop/app/hadoop-2.6.0-cdh5.7.0/logs/hadoop-hadoop-datanode-hadoop001.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /home/hadoop/app/hadoop-2.6.0-cdh5.7.0/logs/hadoop-hadoop-secondarynamenode-hadoop001.out
19/02/23 19:12:28 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ jps
2842 NameNode
3226 Jps
3117 SecondaryNameNode
2959 DataNode

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ vim ~/.bash_profile
export HADOOP_PREFIX=/home/hadoop/app/hadoop-2.6.0-cdh5.7.0
export PATH=$HADOOP_PREFIX/bin:$PATH

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ source ~/.bash_profile

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ hdfs dfs -ls /
19/02/23 19:16:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ hdfs dfs -mkdir /hello
19/02/23 19:17:37 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@hadoop001 hadoop-2.6.0-cdh5.7.0]$ hdfs dfs -ls /
19/02/23 19:17:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
drwxr-xr-x - hadoop supergroup 0 2019-02-23 19:17 /hello

标签:java,19,部署,23,hadoop,hadoop001,root
来源: https://www.cnblogs.com/liangweixiong/p/10423843.html