<configuration> <property> <name>fs.default.name</name> <value>hdfs://hadoop:8020</value> </property> <!-- 以下配置可防止系统重启导致NameNode 不能启动--> <!-- /Users/用户名/data 这个路径你可以随便配置, hadoop必须有权限--> <property> <name>hadoop.tmp.dir</name> <value>/Users/liyang/Documents/hadoop/tmp</value> <description>A base for other temporary directories.</description> </property> <!-- DataNode存放块数据的本地文件系统路径 --> <property> <name>dfs.name.dir</name> <value>/Users/liyang/Documents/hadoop/filesystem/name</value> <description>Determines where on the local filesystem the DFS name node should store the name table. If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy. </description> </property> <property> <name>dfs.data.dir</name> <value>/Users/liyang/Documents/hadoop/filesystem/data</value> <description>Determines where on the local filesystem an DFS data node should store its blocks. If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. Directories that do not exist are ignored.</description> </property> </configuration>
修改hdfs-site.xml
1
vim /usr/local/Cellar/hadoop/3.3.4/libexec/etc/hadoop/hdfs-site.xml
(base) ➜ ~ start-all.sh WARNING: Attempting to start all Apache Hadoop daemons as liyang in 10 seconds. WARNING: This is not a recommended production deployment configuration. WARNING: Use CTRL-C to abort. Starting namenodes on [hadoop] Starting datanodes Starting secondary namenodes [hadoop] 2023-06-20 21:00:36,813 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Starting resourcemanager Starting nodemanagers