nfs

Kubernetes 系列(六):持久化存储 PV与PVC(一)

时间秒杀一切 提交于 2019-11-26 21:13:30
在使用容器之后,我们需要考虑的另外一个问题就是持久化存储,怎么保证容器内的数据存储到我们的服务器硬盘上。这样容器在重建后,依然可以使用之前的数据。但是显然存储资源和 CPU 资源以及内存资源有很大不同,为了屏蔽底层的技术实现细节,让用户更加方便的使用, Kubernetes 便引入了 PV 和 PVC 两个重要的资源对象来实现对存储的管理。 一、概念 PV 的全称是:PersistentVolume(持久化卷),是对底层的共享存储的一种抽象,PV 由管理员进行创建和配置,它和具体的底层的共享存储技术的实现方式有关,比如 Ceph、GlusterFS、NFS 等,都是通过插件机制完成与共享存储的对接。 PVC 的全称是:PersistentVolumeClaim(持久化卷声明),PVC 是用户存储的一种声明,PVC 和 Pod 比较类似,Pod 消耗的是节点,PVC 消耗的是 PV 资源,Pod 可以请求 CPU 和内存,而 PVC 可以请求特定的存储空间和访问模式。对于真正使用存储的用户不需要关心底层的存储实现细节,只需要直接使用 PVC 即可。 但是通过 PVC 请求到一定的存储空间也很有可能不足以满足应用对于存储设备的各种需求,而且不同的应用程序对于存储性能的要求可能也不尽相同,比如读写速度、并发性能等,为了解决这一问题,Kubernetes 又为我们引入了一个新的资源对象:

存储卷

烂漫一生 提交于 2019-11-26 21:05:08
前言 默认情况下容器的数据都是非持久化的, 在容器消亡以后数据也跟着丢失, 所以 Docker 提供了 Volume 机制以便将数据持久化存储。 类似的, Kubernetes 提供了更强大的 Volume 机制和丰富的插件, 解决了容器数据持久化和容器间共享数据的问题。 与 Docker 不同, Kubernetes Volume 的生命周期与 Pod 绑定容器挂掉后 Kubelet 再次重启容器时, Volume 的数据依然还在而 Pod 删除时, Volume 才会清理。 数据是否丢失取决于具体的 Volume 类型, 比如 emptyDir 的数据会丢失, 而 PV 的数据则不会丢 PersistentVolume(pv)和PersistentVolumeClaim(pvc)是k8s提供的两种API资源,用于抽象存储细节。管理员关注于如何通过pv提供存储功能而无需关注用户如何使用,同样的用户只需要挂载pvc到容器中而不需要关注存储卷采用何种技术实现。 pvc和pv的关系与pod和node关系类似,前者消耗后者的资源。pvc可以向pv申请指定大小的存储资源并设置访问模式。 pv pvc相关知识 生命周期 pv和pvc遵循以下生命周期: 1.供应准备。管理员在集群中创建多个pv供用户使用。   2.绑定。用户创建pvc并指定需要的资源和访问模式。在找到可用pv之前

一台linux机器远程mount另一台linux机器

∥☆過路亽.° 提交于 2019-11-26 20:06:13
本机电脑系统是unbantu,要将另一台linux电脑上的文件mount到本机目录下。mount的原理是 网络文件系统 ,即NFS,本机操作步骤如下 一,安装 nfs-common : apt install nfs-common 二,编辑 /etc/fstab ,将要挂在的远程目录写入进去: vim etc/fstab (注意编辑要在root模式下) 三,保存之后,执行命令 :mount -a 四,去本机被mount的目录下,去查看是否挂在成功。 来源: https://www.cnblogs.com/chaojiyingxiong/p/11332091.html

inotify with NFS

♀尐吖头ヾ 提交于 2019-11-26 19:48:43
I've recently created a dropbox system using inotify, watching for files created in a particular directory. The directory I'm watching is mounted from an NFS server, and inotify is behaving differently than I'd expect. Consider the following scenario in which an inotify script is run on machine A, watching /some/nfs/dir/also/visible/to/B. -Using machine A to create a file in /some/nfs/dir/also/visible/to/B, the script behaves as expected. Using machine B to carry out the same action, the script is not notified about a new file dropped in the directory. -When the script is run on the NFS server

Vagrant error : Failed to mount folders in Linux guest

核能气质少年 提交于 2019-11-26 19:11:02
I have some issues with Vagrant shared folders, my base system is Ubuntu 13.10 desktop. I do not understand why I have this error is something that is not right configured ? Is a NFS issue or Virtualbox Guest Additions ? I have tried with different many boxes but the same issue. Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant

C# int to byte[]

大憨熊 提交于 2019-11-26 18:20:56
I need to convert an int to a byte[] one way of doing it is to use BitConverter.GetBytes() . But im unsure if that matches the following specification: An XDR signed integer is a 32-bit datum that encodes an integer in the range [-2147483648,2147483647]. The integer is represented in two's complement notation. The most and least significant bytes are 0 and 3, respectively. Integers are declared as follows: Source: RFC1014 3.2 How could i do a int to byte transformation that would satisfy the above specification? paracycle The RFC is just trying to say that a signed integer is a normal 4-byte

shell基础之综合练习

China☆狼群 提交于 2019-11-26 17:06:47
0.脚本一键完成下面所有操作 1.准备2台centos7系统的服务器,远程互相免密登录,以下所有题目过程中开启防火墙 2.给1号机和2号机使用光盘搭建本地yum源(永久生效) 3.给服务器1添加2块硬盘,1块1GB,1块2GB,使用这2块硬盘创建vg,包含pe100mb/块 4.使用上题vg创建2个1.2GB的lv,以xfs格式分别挂载到1号机/目录下的lvm1 lvm2上(永久生效) 5.将lvm2以nfs共享给2号机,挂载到2号机 /nfs 上(永久生效) 6.设置定时任务,每5分钟将/目录下所有文件名称写入到以"日期时间"命名的文件(时间精确到分钟),并保存到/lvm1中 7.在2号记上以/nfs为目录搭建ftp,用户名是 userftp2 密码 123 的非交互用户(1号机可以使用该用户登录) 8.搭建一个httpd网站,工作目录是ftp目录 1 #!/bin/bash 2 #1.准备2台centos7系统的服务器,远程互相免密登录,以下所有题目过程中开启防火墙 3 #2.给1号机和2号机使用光盘搭建本地yum源(永久生效) 4 IP1=192.168.11.135 5 IP2=192.168.11.136 6 echo "$IP1 test1 7 $IP2 test2" >> /etc/hosts 8 #检查环境 9 setenforce 0 10 sed -i 's/

linux NFS 自动挂载

女生的网名这么多〃 提交于 2019-11-26 16:57:06
NFS 自动挂载的两种方法 第一种: 需要注意的事项 开机挂载的命令不能写入到/etc/fstab 中,由于 NFS 依赖于网络,而/etc/fstab 的引用是在计算机 网络尚未启动的时候就开始引导,因此肯定无法挂载成功!我们应该把挂载命令写入到 /etc/rc.d/rc.local 中;看操作 [root@NFS_Client ~]# vim /etc/rc.d/rc.local mount -t nfs -o nosuid,noexec,nodev,rw,bg,soft,rsize=32768,wsize=32768 192.168.1.4:/home/test /usr/local/live/ 然后介绍下 mount 的各项参数: -t nfs:指定文件系统的类型 nosuid:取消 suid 的功能 noexec:不具有二进制的执行权限 rw:读写 nodev:不保留装置档案的特殊功能 来源: https://www.cnblogs.com/fanweisheng/p/11327669.html

linux 验证 NFS 是否成功

删除回忆录丶 提交于 2019-11-26 16:55:21
服务器端----->>客户端 1. 服务器端 [root@allentuns ~]# ifconfig |grep "Bcast" inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0 [root@allentuns ~]# cd /web/htdocs/ [root@allentuns htdocs]# ls [root@allentuns htdocs]# cat /etc/issue >> index.html [root@allentuns htdocs]# ll total 4 -rw-r--r--. 1 root root 47 May 3 19:06 index.html 2. 查看是否同步到客户端 [root@allentuns ~]# ifconfig |grep "Bcast" inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0 [root@allentuns ~]# cd /mnt/ [root@allentuns mnt]# ll total 4 -rw-r--r--. 1 root root 47 May 3 19:06 index.html 客户端----->>服务器端 1. 客户端创建文件 [root

linux 深入应用 NFS

折月煮酒 提交于 2019-11-26 16:54:58
以下实验大家用主机名来区分服务器端和客户端, 服务器端为 NFS_Server ip-192.168.1.4; 客户端为 NFS_Client ip-192.168.1.5; 实例一 将/tmp 分享给大家使用,让所有的人都可以存取,让 root 写入档案还是具有 root 的权限 [NFS Server] [root@NFS_Server ~]# ll -d /tmp/ #目录 tmp 文件系统本身具有读写权限 drwxrwxrwt. 3 root root 4096 May 3 21:39 /tmp/ [root@NFS_Server ~]# vim /etc/exports /tmp 192.168.1.5(rw,root_squash) [root@NFS_Server ~]# exportfs -r #重新载入配置文件 [root@NFS_Server ~]# ll /tmp total 0 -rw-------. 1 root root 0 Apr 23 15:05 yum.log [root@NFS_Client ~]# mkdir /share1 #创建挂载目录 [root@NFS_Client ~]# ll /share1/ total 0 [root@NFS_Client ~]# mount -t nfs 192.168.1.4:/tmp/ /share1/