您的位置:首页 > 其它

nfs文件共享+netstat相关 记录

2014-04-10 14:13 316 查看
经常要创建nfs文件共享,每次都要重新找一下笔记,特记录下来方便查找:

一般linux自带有nfs应用,所以要使用时,只要启用即可,启动过程如下:

服务端:
在/etc/exports 里面加入要nfs的目录,开放可mount的对象IP,例如:
/data/test 192.168.*(rw,sync,no_root_squash)

然后启动相关进程:

service nfs start
service portmap start

客户端:
service portmap start
mount -t nfs 192.168.101.234:/data/test /data/test (mount命令)

查看已经发布出来的nfs可挂接点:
服务端:showmount -e localhost
客户端:showmount -e 服务端IP

参考页面:
http://linux.chinaunix.net/techdoc/system/2007/03/26/953339.shtml

--------------------------------------------------------------------
netstat 的一些使用方法,记录一下,不完全之处后面碰到再补充:
1、使用 netstat -nlt 查看端口使用情况
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN

2、使用 netstat -nltp 查看端口使用情况,并反应出端口使用的程序名称和进程号
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2485/zabbix_agentd
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 2535/mongod

3、如果要查具体某个程序或者端口的情况,在后面加 grep 即可:
root@test03:/root#netstat -nltp|grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6509/mysqld
root@test03:/root#netstat -nltp|grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6509/mysqld

4、查看端口属于哪个程序
root@test03:/root#lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
mysqld 6509 mysql 10u IPv4 15134 TCP *:mysql (LISTEN)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: