`

Ubuntu NFS配置实例指南V1.0

阅读更多

 

故事:我有两台服务器  122,123,搭建了tomcat 集群,由于开发环境和正式环境不一样的配置,我需要在正式环境服务器上留下正式环境的配置文件,发布的时候,使用这些预留的配置文件覆盖即可

由于两台服务器使用的项目配置文件是一样的,我不想两台服务器上都去维护这些预留的配置文件

122服务器上我建个webapps/backupConfig文件夹, 123共享到

 

操作系统:Ubuntu,122(nfs服务端),123(nfs客户端)

文中提到的ip地址仅供参考

 

步骤:

 

1.122 安装nfs

sudo apt-get install nfs-kernel-server

 

2.122 webapps/backupConfig 文件夹共享出去

sudo vim /etc/exports

里面加入

/home/appuser/webapps/backupConfig 172.88.88.123(rw,sync,no_root_squash)

 

: 172.88.88.123 123 (nfs客户端服务器)

 

3.122 创建个重启 nfs shellrestart-nfs.sh

#!/bin/bash

#echo "create by jinxin 2012-06-30"

 

echo "restart nfs"

 

sudo /etc/init.d/nfs-kernel-server restart

sudo /etc/init.d/portmap restart

 

3.1 设置sh 运行权限并运行

chmod +x *.sh

 

./restart-nfs.sh

 

4.至此 122 nfs服务端已经配置完毕

123 客户端,安装nfs-common

sudo apt-get install nfs-common

 

5.123  创建个 mount shell mount-backup-config.sh

 

#!/bin/bash

#echo "create by jinxin 2012-06-30"

 

echo "mount-backup-config.sh"

 

echo "mkdir -p webapps/backupConfig"

mkdir -p webapps/backupConfig

 

echo "sudo mount 172.88.88.122:/home/appuser/webapps/backupConfig /home/appuser/webapps/backupConfig"

sudo mount 172.88.88.122:/home/appuser/webapps/backupConfig /home/appuser/webapps/backupConfig

 

5.1 设置sh 运行权限并运行

chmod +x *.sh

 

./mount-backup-config.sh

 

这样就配置完成了

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics