如何处理服务器重启后,日志分析的重新挂载的问题

假设已经在日志分析机器上安装了文件挂载软件 ,也假设之前已经建立了文件夹。1. 在命令行

  cd /mnt/
  fusermount -u share 或 fusermount -u /mnt/share (会提示命令有误)
  umount -l /mnt/share 或 umount -l  share  (这个命令顶用)
  cd /mnt/share  (成功的话,就意味着已经解锁了)
  sshfs root@192.168.56.14:/var/log/nginx/he /mnt/share 
  sshfs root@192.102.*.*:/var/log/***/111 /mnt/share (挂载命令)

2.安装sshfs 并建立文件夹

  apt-get install sshfs (ubuntu)
  find / -name sshfs 
  
  mkdir ... + chmod ...

3.centos下安装sshfs


wget it

wget http://sourceforge.net/projects/fuse/files/fuse-2.X/2.8.7/fuse-2.8.7.tar.gz 

untar

tar zxf fuse-2.8.7.tar.gz

cd into the dir

 cd fuse-2.8.7

be root

sudo su

or

 su -

configure, make, make install

./configure;make;make install

give some libs

echo '/usr/local/lib' > /etc/ld.so.conf.d/fuse.conf

ldconfig

ldconfig

grab sshfs from http://fuse.sourceforge.net/sshfs.html and wget the stable

wget http://sourceforge.net/projects/fuse/files/sshfs-fuse/2.4/sshfs-fuse-2.4.tar.gz

untar

tar zxf sshfs-fuse-2.4.tar.gz

Do all the makes!

 cd sshfs-fuse-2.4
./configure;make;make install

Turns out we have some prerequisits
Error:

No package 'glib-2.0' found
No package 'gthread-2.0' found

Fixes

yum install glib2-devel

now rerun the makes!

./configure;make;make install

Good to go! Now make the mount point

mkdir /mnt/yourmom.com

Done and done.

Switch back to your normal user(or if only root you may need to add /usr/local/bin/ to your path or call sshfs using the direct path) now we can mount a remote filesystem using this syntax

sshfs user@remote-address.com:/media/megabiglife /mnt/yourmom.com

You will then be prompted for the password on the remote host. Some people prefer passwordless authentication using keys, if you are looking for this, I suggest checking here http://lmgtfy.com/?q=how+to+set+up+ssh+keys

In my case, the ssh server at the remote host is running on a custom port, if anyone cares, break the logical protocol and add the port number after the sshfs command

sshfs -p 1234 user@hostname:/media/megabiglife /mnt/yourmom.com

To un mount run

umount /mnt/yourmom.com

In case it wasn't obvious, you should replace the username and hostname fields when using this tutorial. I do like the idea of yourmom.com and megabiglife mounts so that is optional.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值