NFS网络文件系统

如果大家觉得Samba服务程序的配置太麻烦了,那么你共享文件的主机都是Linux系统,那么推荐大家在客户端部署nfs服务来共享文件.nfs(网络文件系统)服务可以将远程Linux系统上的文件共享资源挂载到本地主机的目录上,从而使得本地主机客户端基于TCP/IP协议,像是用本地主机上的资源那样读写远程Linux系统上的共享文件.

实验环境

主机 操作系统 IP地址
NFS服务器 RHEL7.4 192.168.56.15
NFS客户端 CentOS7.4 192.168.56.5
前期准备这里我把防火墙以及selinux都给关闭了.

1 安装 NFS-Server 使用 yum install nfs-utils rpcbind -y 命令.

  1. [root@qdlinux ~]# yum install -y nfs-utils rpcbind
  2. Loaded plugins: product-id, search-disabled-repos, subscription-manager
  3. This system is not registered with an entitlement server. You can use subscription-manager to register.
  4. dvd | 4.1 kB 00:00:00
  5. Resolving Dependencies
  6. --> Running transaction check
  7. ---> Package nfs-utils.x86_64 1:1.3.0-0.48.el7 will be installed
  8. --> Processing Dependency: gssproxy >= 0.7.0-3 for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  9. --> Processing Dependency: libtirpc >= 0.2.4-0.7 for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  10. --> Processing Dependency: libevent for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  11. --> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  12. --> Processing Dependency: quota for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  13. --> Processing Dependency: libevent-2.0.so.5()(64bit) for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  14. --> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  15. --> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.3.0-0.48.el7.x86_64
  16. ---> Package rpcbind.x86_64 0:0.2.0-42.el7 will be installed
  17. --> Running transaction check
  18. ---> Package gssproxy.x86_64 0:0.7.0-4.el7 will be installed
  19. --> Processing Dependency: libini_config.so.3(INI_CONFIG_1.1.0)(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  20. --> Processing Dependency: libini_config.so.3(INI_CONFIG_1.2.0)(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  21. --> Processing Dependency: libref_array.so.1(REF_ARRAY_0.1.1)(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  22. --> Processing Dependency: libverto-module-base for package: gssproxy-0.7.0-4.el7.x86_64
  23. --> Processing Dependency: libbasicobjects.so.0()(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  24. --> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  25. --> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  26. --> Processing Dependency: libref_array.so.1()(64bit) for package: gssproxy-0.7.0-4.el7.x86_64
  27. ---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed
  28. ---> Package libnfsidmap.x86_64 0:0.25-17.el7 will be installed
  29. ---> Package libtirpc.x86_64 0:0.2.4-0.10.el7 will be installed
  30. ---> Package quota.x86_64 1:4.01-14.el7 will be installed
  31. --> Processing Dependency: quota-nls = 1:4.01-14.el7 for package: 1:quota-4.01-14.el7.x86_64
  32. --> Processing Dependency: tcp_wrappers for package: 1:quota-4.01-14.el7.x86_64
  33. --> Running transaction check
  34. ---> Package libbasicobjects.x86_64 0:0.1.1-27.el7 will be installed
  35. ---> Package libcollection.x86_64 0:0.6.2-27.el7 will be installed
  36. ---> Package libini_config.x86_64 0:1.3.0-27.el7 will be installed
  37. --> Processing Dependency: libpath_utils.so.1(PATH_UTILS_0.2.1)(64bit) for package: libini_config-1.3.0-27.el7.x86_64
  38. --> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.3.0-27.el7.x86_64
  39. ---> Package libref_array.x86_64 0:0.1.5-27.el7 will be installed
  40. ---> Package libverto-tevent.x86_64 0:0.2.5-4.el7 will be installed
  41. ---> Package quota-nls.noarch 1:4.01-14.el7 will be installed
  42. ---> Package tcp_wrappers.x86_64 0:7.6-77.el7 will be installed
  43. --> Running transaction check
  44. ---> Package libpath_utils.x86_64 0:0.2.1-27.el7 will be installed
  45. --> Finished Dependency Resolution
  46. Dependencies Resolved
  47. =================================================================================================================
  48. Package Arch Version Repository Size
  49. =================================================================================================================
  50. Installing:
  51. nfs-utils x86_64 1:1.3.0-0.48.el7 dvd 398 k
  52. rpcbind x86_64 0.2.0-42.el7 dvd 59 k
  53. Installing for dependencies:
  54. gssproxy x86_64 0.7.0-4.el7 dvd 105 k
  55. libbasicobjects x86_64 0.1.1-27.el7 dvd 25 k
  56. libcollection x86_64 0.6.2-27.el7 dvd 41 k
  57. libevent x86_64 2.0.21-4.el7 dvd 214 k
  58. libini_config x86_64 1.3.0-27.el7 dvd 63 k
  59. libnfsidmap x86_64 0.25-17.el7 dvd 49 k
  60. libpath_utils x86_64 0.2.1-27.el7 dvd 27 k
  61. libref_array x86_64 0.1.5-27.el7 dvd 26 k
  62. libtirpc x86_64 0.2.4-0.10.el7 dvd 89 k
  63. libverto-tevent x86_64 0.2.5-4.el7 dvd 9.0 k
  64. quota x86_64 1:4.01-14.el7 dvd 179 k
  65. quota-nls noarch 1:4.01-14.el7 dvd 91 k
  66. tcp_wrappers x86_64 7.6-77.el7 dvd 79 k
  67. Transaction Summary
  68. =================================================================================================================
  69. Install 2 Packages (+13 Dependent packages)
  70. Total download size: 1.4 M
  71. Installed size: 4.1 M
  72. Downloading packages:
  73. -----------------------------------------------------------------------------------------------------------------
  74. Total 2.5 MB/s | 1.4 MB 00:00:00
  75. Running transaction check
  76. Running transaction test
  77. Transaction test succeeded
  78. Running transaction
  79. Installing : libref_array-0.1.5-27.el7.x86_64 1/15
  80. Installing : libcollection-0.6.2-27.el7.x86_64 2/15
  81. Installing : libbasicobjects-0.1.1-27.el7.x86_64 3/15
  82. Installing : libtirpc-0.2.4-0.10.el7.x86_64 4/15
  83. Installing : rpcbind-0.2.0-42.el7.x86_64 5/15
  84. Installing : 1:quota-nls-4.01-14.el7.noarch 6/15
  85. Installing : libpath_utils-0.2.1-27.el7.x86_64 7/15
  86. Installing : libini_config-1.3.0-27.el7.x86_64 8/15
  87. Installing : tcp_wrappers-7.6-77.el7.x86_64 9/15
  88. Installing : 1:quota-4.01-14.el7.x86_64 10/15
  89. Installing : libevent-2.0.21-4.el7.x86_64 11/15
  90. Installing : libnfsidmap-0.25-17.el7.x86_64 12/15
  91. Installing : libverto-tevent-0.2.5-4.el7.x86_64 13/15
  92. Installing : gssproxy-0.7.0-4.el7.x86_64 14/15
  93. Installing : 1:nfs-utils-1.3.0-0.48.el7.x86_64 15/15
  94. Verifying : libverto-tevent-0.2.5-4.el7.x86_64 1/15
  95. Verifying : rpcbind-0.2.0-42.el7.x86_64 2/15
  96. Verifying : 1:quota-4.01-14.el7.x86_64 3/15
  97. Verifying : libtirpc-0.2.4-0.10.el7.x86_64 4/15
  98. Verifying : libnfsidmap-0.25-17.el7.x86_64 5/15
  99. Verifying : libini_config-1.3.0-27.el7.x86_64 6/15
  100. Verifying : libbasicobjects-0.1.1-27.el7.x86_64 7/15
  101. Verifying : libevent-2.0.21-4.el7.x86_64 8/15
  102. Verifying : tcp_wrappers-7.6-77.el7.x86_64 9/15
  103. Verifying : libpath_utils-0.2.1-27.el7.x86_64 10/15
  104. Verifying : 1:quota-nls-4.01-14.el7.noarch 11/15
  105. Verifying : gssproxy-0.7.0-4.el7.x86_64 12/15
  106. Verifying : libcollection-0.6.2-27.el7.x86_64 13/15
  107. Verifying : libref_array-0.1.5-27.el7.x86_64 14/15
  108. Verifying : 1:nfs-utils-1.3.0-0.48.el7.x86_64 15/15
  109. Installed:
  110. nfs-utils.x86_64 1:1.3.0-0.48.el7 rpcbind.x86_64 0:0.2.0-42.el7
  111. Dependency Installed:
  112. gssproxy.x86_64 0:0.7.0-4.el7 libbasicobjects.x86_64 0:0.1.1-27.el7 libcollection.x86_64 0:0.6.2-27.el7
  113. libevent.x86_64 0:2.0.21-4.el7 libini_config.x86_64 0:1.3.0-27.el7 libnfsidmap.x86_64 0:0.25-17.el7
  114. libpath_utils.x86_64 0:0.2.1-27.el7 libref_array.x86_64 0:0.1.5-27.el7 libtirpc.x86_64 0:0.2.4-0.10.el7
  115. libverto-tevent.x86_64 0:0.2.5-4.el7 quota.x86_64 1:4.01-14.el7 quota-nls.noarch 1:4.01-14.el7
  116. tcp_wrappers.x86_64 0:7.6-77.el7
  117. Complete!

2 启动 NFS-Server

  1. [root@qdlinux ~]# systemctl start rpcbind
  2. [root@qdlinux ~]# systemctl enable rpcbind
  3. [root@qdlinux ~]# systemctl start nfs-server.service
  4. [root@qdlinux ~]# systemctl enable nfs-server.service
  5. Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

启动和启用NFS服务程序,由于在使用NFS服务进行文件共享之前,需要使用RPC(Remote Procedure Call,远程过程调用),服务将NFS服务器的IP地址和端口号等信息发送给客户端.因此,在启动NFS服务之前,还需要顺带重启并启动rpcbind服务,这里将两个服务一并加入到开机启动项中.

3 可以使用 rpcbind -p 查看一下注册的信息.

  1. [root@qdlinux ~]# rpcinfo -p
  2. program vers proto port service
  3. 100000 4 tcp 111 portmapper
  4. 100000 3 tcp 111 portmapper
  5. 100000 2 tcp 111 portmapper
  6. 100000 4 udp 111 portmapper
  7. 100000 3 udp 111 portmapper
  8. 100000 2 udp 111 portmapper
  9. 100024 1 udp 43946 status
  10. 100024 1 tcp 38188 status
  11. 100005 1 udp 20048 mountd
  12. 100005 1 tcp 20048 mountd
  13. 100005 2 udp 20048 mountd
  14. 100005 2 tcp 20048 mountd
  15. 100005 3 udp 20048 mountd
  16. 100005 3 tcp 20048 mountd
  17. 100003 3 tcp 2049 nfs
  18. 100003 4 tcp 2049 nfs
  19. 100227 3 tcp 2049 nfs_acl
  20. 100003 3 udp 2049 nfs
  21. 100003 4 udp 2049 nfs
  22. 100227 3 udp 2049 nfs_acl
  23. 100021 1 udp 35724 nlockmgr
  24. 100021 3 udp 35724 nlockmgr
  25. 100021 4 udp 35724 nlockmgr
  26. 100021 1 tcp 44097 nlockmgr
  27. 100021 3 tcp 44097 nlockmgr
  28. 100021 4 tcp 44097 nlockmgr

4 查看系统相关进程信息

  1. [root@qdlinux ~]# ps -ef | egrep "rpc|nfs"
  2. rpc 1959 1 0 16:37 ? 00:00:00 /sbin/rpcbind -w
  3. rpcuser 2039 1 0 16:38 ? 00:00:00 /usr/sbin/rpc.statd
  4. root 2047 2 0 16:38 ? 00:00:00 [rpciod]
  5. root 2057 1 0 16:38 ? 00:00:00 /usr/sbin/rpc.mountd
  6. root 2058 1 0 16:38 ? 00:00:00 /usr/sbin/rpc.idmapd
  7. root 2068 2 0 16:38 ? 00:00:00 [nfsd4_callbacks]
  8. root 2074 2 0 16:38 ? 00:00:00 [nfsd]
  9. root 2075 2 0 16:38 ? 00:00:00 [nfsd]
  10. root 2076 2 0 16:38 ? 00:00:00 [nfsd]
  11. root 2077 2 0 16:38 ? 00:00:00 [nfsd]
  12. root 2078 2 0 16:38 ? 00:00:00 [nfsd]
  13. root 2079 2 0 16:38 ? 00:00:00 [nfsd]
  14. root 2080 2 0 16:38 ? 00:00:00 [nfsd]
  15. root 2081 2 0 16:38 ? 00:00:00 [nfsd]
  16. root 2135 1633 0 16:52 pts/0 00:00:00 grep -E --color=auto rpc|nfs

5 NFS服务端配置共享目录

参数 作用
ro 只读
rw 读写
root_squash 当NFS客户端以root管理员访问时,映射为NFS服务器的匿名用户
no_root_squash 当NFS客户端以root管理员访问时,映射为NFS服务器的root管理员
all_squash 无论NFS客户端使用什么账户访问,均映射为NFS服务器的匿名用户
sync 同时将数据写入到内存与硬盘中,保证不丢失数据
async 优先将数据保存到内存,然后再写入到硬盘,这样效率更高,但可能会丢失数据
  1. [root@qdlinux ~]# vim /etc/exports
  2. /nfsfile 192.168.56.*(rw,sync,all_squash)
  3. //创建需要共享的目录
  4. [root@qdlinux ~]# mkdir /nfsfile
  5. [root@qdlinux ~]# systemctl restart nfs-server.service
  6. [root@qdlinux ~]# cat /var/lib/nfs/etab
  7. /nfsfile 192.168.56.*(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,secure,root_squash,all_squash)
  8. //查看一下id=65534是哪一个用户
  9. [root@qdlinux ~]# grep "65534" /etc/passwd
  10. nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
  11. //修改一下`/nfsfile`的权限,这里也可以把目录所属主和所属组改为nfsnobody或者直接给成777权限
  12. [root@qdlinux ~]# chmod -Rf nfsnobody:nfsnobody /nfsfile/
  13. //在目录下写入一个文件用于测试
  14. [root@qdlinux ~]# echo "welecome to qdlinux" > /nfsfile/readme
  15. [root@qdlinux ~]# ll /nfsfile/
  16. total 4
  17. -rw-r--rwx 1 root root 20 Aug 16 17:30 readme
  18. [root@qdlinux ~]#

NFS客户端的配置步骤十分简单,先使用 showmount 命令查询NFS服务器的远程共享信息,其输出格式为"共享的目录名称 允许使用客户端地址".

参数 作用
-e 显示NFS服务器的共享李彪
-a 显示本机挂载的文件资源的情况
-v 显示版本号
  1. [root@qdlinux ~]# showmount -e 192.168.56.15
  2. Export list for 192.168.56.15:
  3. /nfsfile 192.168.56.*

6 客户端测试

  1. [root@qdlinux ~]# yum install nfs-utils rpcbind -y
  2. [root@qdlinux ~]# systemctl start rpcbind
  3. [root@qdlinux ~]# systemctl is-enabled rpcbind
  4. enabled
  5. [root@qdlinux ~]# systemctl is-active rpcbind
  6. active
  7. //查询一下服务是否运行
  8. [root@qdlinux ~]# systemctl status rpcbind
  9. rpcbind.service - RPC bind service
  10. Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
  11. Active: active (running) since Thu 2018-08-16 14:05:32 CST; 3h 48min ago
  12. Main PID: 568 (rpcbind)
  13. Tasks: 1
  14. CGroup: /system.slice/rpcbind.service
  15. └─568 /sbin/rpcbind -w
  16. Aug 16 14:05:27 qdlinux.com systemd[1]: Starting RPC bind service...
  17. Aug 16 14:05:32 qdlinux.com systemd[1]: Started RPC bind service.
  18. //在客户端使用`showmount -e`命令查询一下
  19. [root@qdlinux ~]# showmount -e 192.168.56.15 NFS服务器共享列表
  20. Export list for 192.168.56.15:
  21. /nfsfile 192.168.56.*

7 NFS客户端挂载

在NFS客户端创建一个挂在目录,使用mount命令加-t参数,指定要挂在的文件系统的类型,并在命令后面写上服务器的IP地址、服务器上的共享目录以及要挂载到本地系统(客户端)的目录.

  1. [root@qdlinux /]# mkdir /data
  2. [root@qdlinux /]# mount -t nfs 192.168.56.15:/nfsfile /data
  3. //现在已经挂载成功了,可以看到在NFS服务器上创建的文件了.

如果希望NFS文件共享服务能一直有效,需要将其写入到 fstab 文件中.

  1. [root@qdlinux data]# vim /etc/fstab
  2. 192.168.56.15:/nfsfile /data nfs defaults 0 0
  1. 1 如果NFS服务器宕机,强制卸载umount -lf /data
  2. 2 [root@qdlinux data]# umount /data
  3. umount.nfs4: /data: device is busy
  4. 出现这种情况时,退出挂载目录然后在卸载

8 autofs自动挂载服务

autofs服务程序是一种Linux系统守护进程,当检测到用户试图去访问一个尚未挂载的文件系统时,将自动挂载该文件系统,我们将挂载信息写入/etc/fstab文件后,系统在每次开机时都自动将其挂载,而autofs自动挂载服务是用户需要使用该文件系统时才会去动态挂载,从而节约了网络资源和服务器的硬件资源.

  1. [root@qdlinux /]# yum install autofs -y

直接挂载方式,本地的挂载点是绝对路径

  1. [root@qdlinux /]# vim /etc/auto.master.d/nfs.autofs
  2. /- /etc/auto.nfs_direct
  3. [root@qdlinux /]# vim /etc/auto.nfs_direct
  4. /data -rw,sync,soft 192.168.56.15:/nfsfile
  5. //mount查看一下
  6. /etc/auto.nfs_direct on /data type autofs (rw,relatime,fd=18,pgrp=6217,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=79495)

间接挂载方式

  1. [root@qdlinux ~]# mkdir -p /public/share
  2. [root@qdlinux ~]# chown -Rf nfsnobody:nfsnobody /public/share
  3. [root@qdlinux ~]# vim /etc/exports
  4. /public/share 192.168.56.*(rw,sync,all_squash)
  5. //重新启动nfs-server
  6. [root@qdlinux ~]# showmount -e 192.168.56.15
  7. Export list for 192.168.56.15:
  8. /public/share 192.168.56.*
  9. /nfsfile 192.168.56.*
  10. [root@qdlinux /]# mkdir /test
  11. [root@qdlinux /]# vim /etc/auto.master.d/share.autofs
  12. /test /etc/share.nfs_share
  13. [root@qdlinux /]# vim /etc/share.nfs_share
  14. * -rw,sync,soft 192.168.56.15:/public/&
  15. //重新启动autofs服务

现在可以访问了,客户端当你切换到/test/share时可以创建文件服务端实时同步.

Linux基础学习-NFS网络文件系统实时文件共享的更多相关文章

  1. Linux基础学习系列目录导航

    Linux基础学习-通过VM安装RHEL7.4 Linux基础学习-命令行与图形界面切换 Linux基础学习-基本命令 Linux基础学习-RHEL7.4之YUM更换CentOS源 Linux基础学习 ...

  2. [学习嵌入式开发板]iTOP-4412实现NFS网络文件系统

    本文转自迅为:http://www.topeetboard.com 学习平台:iTOP-4412开发板 本文讲解如何在 iTOP-4412 开发板上实现 NFS 网络文件系统. 我们使用的软硬件环境是 ...

  3. Linux系统NFS网络文件系统

    Linux系统NFS网络文件系统 NFS(network file system)网络文件系统,就是通过网络让不同的主机系统之间可以共享文件或目录,此种方法NFS客户端使用挂载的方式让共享文件或目录到 ...

  4. Linux系统——NFS网络文件系统

    在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频,图片,附件等静态资源文件,通常网站用户上传的文件都会放到NFS共享里,然后前端所有的节点访问这些静态资源时都会读取NFS存储上的资 ...

  5. linux初学者-NFS网络文件系统篇

    linux初学者-NFS网络文件系统篇 在上一篇的SAMBA篇中介绍了linux系统和windows系统之间共用的网络文件系统CIFS,主要用于客户端是windows的情况.在linux系统之间,所用 ...

  6. NFS 网络文件系统挂载在A8板子上

    我承认自己是菜鸟,没什么网络知识就来搞挂载nfs网络文件系统,花费了5天的时间才把nfs网络文件系统成功挂载在A8板子上,实现了A8板子和虚拟机的文件共享.分享一下个人经验: 以下是基于nfs已经完成 ...

  7. linux基础学习之软件安装以及常用命令

    linux基础学习之软件安装以及常用命令 调用中央仓库: yum install wget 然后下载nodejs: wget https://nodejs.org/dist/v10.14.2/node ...

  8. NFS(网络文件系统)

    NFS(网络文件系统) 1.关于NFS介绍 1.1NFS在企业中的应用场景 在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频,图片,附件等静态资源文件,通常网站用户上传的文件都会放 ...

  9. linux下使用NFS挂载文件系统

    转自linux如何使用NFS挂载文件系统 设备:一台服务器和一台客户端,这里我们把装在PC机上的RedHat作为服务器,而客户端则是嵌入式linux开发板. 环境:开发板已启动,连接好串口和网线,串口 ...

随机推荐

  1. Hive进阶_Hive的客户端操作

    启动远程客户端 # hive --service hiveserver2获取连接-〉创建运行环境-〉执行HQL-〉处理结果-〉释放资源 工具类 package demo.utils; import j ...

  2. 牛客网Java刷题知识点之什么是内部类、为什么要使用内部类、内部类如何使用外部类的属性和方法、成员内部类、局部内部类、静态内部类、匿名内部类

    不多说,直接上干货! 可以将一个类的定义放在另一个类的定义内部,这就是内部类. 内部类是一个非常有用的特性但又比较难理解使用的特性(鄙人到现在都没有怎么使用过内部类,对内部类也只是略知一二). 内部类 ...

  3. AJPFX关于ArrayList集合容器的操作

    1.创建     ArrayList<Egg> myList=new ArrayList<Egg>(); //<Egg>代表创建出Egg类型的List,新的Arra ...

  4. 遍历List集合的方式

    遍历List集合的方式有很多,现在举出最常见的三种 List<String> list = new ArrayList<String>(); list.add("a& ...

  5. 《超实用的Node.js代码段》连载一:获取Buffer对象字节长度

    我们知道Node.js框架下的Buffer对象能够对二进制数据提供很好的支持,那么获取一个Buffer对象真实的字节长度则是必须要用到的功能了.Node.js框架为开发人员提供了一个Buffer.by ...

  6. mitmproxy抓包软件在mac上边的安装

    官网介绍:mitmproxy is a free and open source interactive HTTPS proxy. mitmproxy 是用 Python 和 C 开发的一个中间人代理 ...

  7. Objective-C Inheritance

    One of the most important concepts in object-oriented programming is that of inheritance. Inheritanc ...

  8. String | StringBuffer | StringBuilder 比较

    2016的第一天,我决定写一篇博客来纪念这一天,希望一年好运吧. String|StringBuffer|StringBuilder这三者在我们学习JAVASE核心API的时候常常出来,而且大多数入门 ...

  9. POJ 1185 炮兵阵地 (状压DP,轮廓线DP)

    题意: 给一个n*m的矩阵,每个格子中有'P'或者'H',分别表示平地和高原,平地可以摆放大炮,而大炮的攻击范围在4个方向都是2格(除了自身位置),攻击范围内不能有其他炮,问最多能放多少个炮?(n&l ...

  10. BZOJ 4896 :[Thu Summer Camp2016]补退选 Trie树+Vector

    4896: [Thu Summer Camp2016]补退选 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 315  Solved: 97[Submi ...