#vim /etc/httpd/conf.d/cdh_yum.conf
<VirtualHost *:80>
ServerAdmin webmaster@gongchang.com
DocumentRoot "/data/hadoop_install/"
ServerName 192.168.8.222
ErrorLog "logs/cm-error.log"
CustomLog "logs/cm-access.log" common
<Directory "/data/hadoop_install/cm/5.0.2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/data/hadoop_install/cdh/5.0.2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
#/etc/init.d/httpd restart //重启httpd服务
然后可以通过浏览器查看是否能够访问http://192.168.8.222/cm/5.0.2
listen 80;
server_name 192.168.8.222;
charset utf-8;
index index.php index.html index.htm;
root /data/hadoop_install;
location /cm/ {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location /cdh/ {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
access_log off;
}
To set up and test your mount point in a non-HA installation:
$ mkdir -p <mount_point> $ hadoop-fuse-dfs dfs://<name_node_hostname>:<namenode_port> <mount_point>
where namenode_port is the NameNode's RPC port, dfs.namenode.servicerpc-address.
To set up and test your mount point in an HA installation:
$ mkdir -p <mount_point> $ hadoop-fuse-dfs dfs://<nameservice_id> <mount_point>
where nameservice_id is the value of fs.defaultFS. In this case the port defined for dfs.namenode.rpc-address.[nameservice ID].[name node ID] is used automatically. See Configuring Software for HDFS HA for more information about these properties.
To find its configuration directory, hadoop-fuse-dfs uses the HADOOP_CONF_DIR configured at the time the mount command is invoked.
To clean up your test:
$ umount <mount_point>
You can now add a permanent HDFS mount which persists through reboots. To add a system mount:
- Open /etc/fstab and add lines to the bottom similar to these:
hadoop-fuse-dfs#dfs://<name_node_hostname>:<namenode_port> <mount_point> fuse allow_other,usetrash,rw 2 0
For example:
hadoop-fuse-dfs#dfs://localhost:8020 /mnt/hdfs fuse allow_other,usetrash,rw 2 0
- Test to make sure everything is working properly:
$ mount <mount_point>
Your system is now configured to allow you to use the ls command and use that mount point as if it were a normal system disk.
By default, the CDH 5 package installation creates the /etc/default/hadoop-fuse file with a maximum heap size of 128 MB. You can change the JVM minimum and maximum heap size; for example
To change it:
export LIBHDFS_OPTS="-Xms64m -Xmx256m"
Be careful not to set the minimum to a higher value than the maximum.
For more information, see the help for hadoop-fuse-dfs:
$ hadoop-fuse-dfs --help