Centos7下Kubernetes配置使用GlusterFS

KubeSphere 部署的 (k8s)Kubernetes 集群使用 GlusterFS 存储实战入门 上一期实战课程,我们模拟真实的生产环境实战演示了如何使用 KubeKey 将新增 Worker 节点添加到已有的 Kubernetes 集群。最终我们部署完成了一套 3 Master 和 3 Worker 节点的 Kubernetes 集群。本期实战课程,我们将实战如何在上安装部署 GlusterFS、Hekeiti 以及 Kubernetes 使用模式对接 GlusterFS 做为集群的后端存储。 阅读详情

操作环境

网络拓扑



环境说明:

OS:
[html]  view plain  copy
  1. CentOS Linux release 7.4.1708   
docker:

[html]  view plain  copy
  1. Client:  
  2.  Version:         1.12.6  
  3.  API version:     1.24  
  4.  Package version: docker-1.12.6-68.gitec8512b.el7.centos.x86_64  
  5.  Go version:      go1.8.3  
  6.  Git commit:      ec8512b/1.12.6  
  7.  Built:           Mon Dec 11 16:08:42 2017  
  8.  OS/Arch:         linux/amd64  
  9.   
  10. Server:  
  11.  Version:         1.12.6  
  12.  API version:     1.24  
  13.  Package version: docker-1.12.6-68.gitec8512b.el7.centos.x86_64  
  14.  Go version:      go1.8.3  
  15.  Git commit:      ec8512b/1.12.6  
  16.  Built:           Mon Dec 11 16:08:42 2017  
  17.  OS/Arch:         linux/amd64  
kubernetes:

[html]  view plain  copy
  1. Kubernetes v1.5.2  
glusterfs:

[html]  view plain  copy
  1. glusterfs 3.12.3  

操作步骤

    Kubernetes环境已经完成部署完成,部署步骤参照  Centos7 下Kubernetes集群安装部署。

部署Glusterfs

    这里有5台服务器,10.10.200.226、10.10.200.227作为GlusterFS存储服务器,10.10.200.224、

10.10.200.229、10.10.200.230调用GlusterFS,同样也需要安装Gluster。

1.分别在5台服务器上安装Gluster

[html]  view plain  copy
  1. [root@k8s-master ~]#yum -y install centos-release-gluster  
  2. [root@k8s-master ~]#yum -y install glusterfs glusterfs-fuse glusterfs-server  
2.启动Glusterfs


[html]  view plain  copy
  1. [root@k8s-master ~]#systemctl enable glusterd  
  2. [root@k8s-master ~]#systemctl start glusterd  
3.创建GlusterFS Cluster

编辑/etc/hosts文件

[html]  view plain  copy
  1. [root@k8s-master ~]# vi /etc/hosts  
  2. 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4  
  3. ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6  
  4. 10.10.200.226   glusterfs-node1  
  5. 10.10.200.227   glusterfs-node2  
  6. 10.10.200.224   k8s-master  
  7. 10.10.200.229   k8s-node1  
  8. 10.10.200.230   k8s-node2  
选择1台服务器添加其他服务器

[html]  view plain  copy
  1. [root@gluster-node1 ~]#gluster peer probe k8s-master  
  2. [root@gluster-node1 ~]#gluster peer probe k8s-node1  
  3. [root@gluster-node1 ~]#gluster peer probe k8s-node2  
  4. [root@gluster-node1 ~]#gluster peer probe gluster-node2  
查看gluster节点状态

[html]  view plain  copy
  1. [root@k8s-master yaml]# gluster peer status  
  2. Number of Peers: 4  
  3.   
  4. Hostname: glusterfs-node2  
  5. Uuid: 3c5c5994-0c05-4be0-9ec3-a431f193a1f0  
  6. State: Peer in Cluster (Connected)  
  7.   
  8. Hostname: glusterfs-node1  
  9. Uuid: 31ac3dff-94a3-4166-991b-bf4727113539  
  10. State: Peer in Cluster (Connected)  
  11.   
  12. Hostname: 10.10.200.229  
  13. Uuid: 7c2f03fe-e2cb-412e-a91f-2baf873610ef  
  14. State: Peer in Cluster (Connected)  
  15. Other names:  
  16. 10.10.200.229  
  17.   
  18. Hostname: 10.10.200.230  
  19. Uuid: 314a7676-d1eb-4c58-9617-8c510c93961d  
  20. State: Peer in Cluster (Connected)  


3.创建volume

这里只选择10.10.200.226/10.10.200.227来进行创建volume


[html]  view plain  copy
  1. [root@gluster-node1 brick1]# gluster volume create mysql-volume replica 2 glusterfs-node2:/data/brick1/mysql-volume/ glusterfs-node1:/data/brick1/mysql-volume/  
启动mysql-volume


[html]  view plain  copy
  1. [root@gluster-node1 brick1]# gluster volume start mysql-volume  
  2. volume start: mysql-volume: success  

查看volume状态

[html]  view plain  copy
  1. [root@gluster-node1 brick1]# gluster volume status  
  2. Status of volume: mysql-volume  
  3. Gluster process                             TCP Port  RDMA Port  Online  Pid  
  4. ------------------------------------------------------------------------------  
  5. Brick glusterfs-node2:/data/brick1/mysql-vo  
  6. lume                                        49152     0          Y       2976   
  7. Brick glusterfs-node1:/data/brick1/mysql-vo  
  8. lume                                        49152     0          Y       7835   
  9. Self-heal Daemon on localhost               N/A       N/A        Y       7856   
  10. Self-heal Daemon on k8s-master              N/A       N/A        Y       2025   
  11. Self-heal Daemon on glusterfs-node2         N/A       N/A        Y       2997   
  12.    
  13. Task Status of Volume mysql-volume  
  14. ------------------------------------------------------------------------------  
  15. There are no active volume tasks  
到这里就完成了2台Glusterfs存储服务器的配置

配置Kubernetes

    可以在https://github.com/kubernetes/kubernetes/tree/master/examples/volumes/glusterfs上面找

到kuernetes配置gluster的文件glusterfs-endpoint.json/glusterfs-pod.json/glusterfs-services.json。

     这里只需要glusterfs-endpoint.json,glusterfs-service.json。

修改glusterfs-endpoint.json文件如下,主要是ip地址的修改

[html]  view plain  copy
  1. [root@k8s-master yaml]# vi glusterfs-endpoints.json   
  2. {  
  3.   "kind": "Endpoints",  
  4.   "apiVersion": "v1",  
  5.   "metadata": {  
  6.     "name": "glusterfs-cluster"  
  7.   },  
  8.   "subsets": [  
  9.     {  
  10.       "addresses": [  
  11.         {  
  12.           "ip": "10.10.200.226"  
  13.         }  
  14.       ],  
  15.       "ports": [  
  16.         {  
  17.           "port": 1  
  18.         }  
  19.       ]  
  20.     },  
  21.     {  
  22.       "addresses": [  
  23.         {  
  24.           "ip": "10.10.200.227"  
  25.         }  
  26.       ],  
  27.       "ports": [  
  28.         {  
  29.           "port": 1  
  30.         }  
  31.       ]  
  32.     }  
  33.   ]  
  34. }  
glusterfs-service.json文件如下,不需修改

[html]  view plain  copy
  1. [root@k8s-master yaml]# vi glusterfs-service.json   
  2. {  
  3.   "kind": "Service",  
  4.   "apiVersion": "v1",  
  5.   "metadata": {  
  6.     "name": "glusterfs-cluster"  
  7.   },  
  8.   "spec": {  
  9.     "ports": [  
  10.       {"port": 1}  
  11.     ]  
  12.   }  
  13. }  
启用上述两文件

[html]  view plain  copy
  1. [root@k8s-master yaml]# kubectl apply -f glusterfs-endpoints.json   
  2. endpoints "glusterfs-cluster" created  
  3. [root@k8s-master yaml]# kubectl apply -f glusterfs-service.json   
  4. service "glusterfs-cluster" created  
[html]  view plain  copy
  1. [root@k8s-master yaml]# kubectl get ep  
  2. NAME                ENDPOINTS                         AGE  
  3. glusterfs-cluster   10.10.200.226:1,10.10.200.227:1   31s  
  4. kubernetes          10.10.200.224:6443                6d  
  5. [root@k8s-master yaml]# kubectl get service  
  6. NAME                CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE  
  7. glusterfs-cluster   172.17.62.135   <none>        1/TCP     33s  
  8. kubernetes          10.254.0.1      <none>        443/TCP   6d  
创建presistent volume以及presistent volume claim yaml文件

[html]  view plain  copy
  1. [root@k8s-master yaml]# vi glusterfs-pv.yaml   
  2. apiVersion: v1  
  3. kind: PersistentVolume  
  4. metadata:  
  5.   name: gluster-dev-volume1  
  6.   labels:  
  7.     name: mysql1  
  8.   
  9. spec:  
  10.   capacity:  
  11.     storage: 10Gi  
  12.   accessModes:  
  13.     - ReadWriteMany  
  14.   glusterfs:  
  15.     endpoints: "glusterfs-cluster"  
  16.     path: "mysql-volume"  
  17.     readOnly: false  
[html]  view plain  copy
  1. [root@k8s-master yaml]# vi glusterfs-pvc.yaml   
  2. apiVersion: v1  
  3. kind: PersistentVolumeClaim  
  4. metadata:  
  5.   name: glusterfs-mysql1  
  6. spec:  
  7.   accessModes:  
  8.     - ReadWriteMany  
  9.   resources:  
  10.     requests:  
  11.       storage: 10Gi  
  12.   selector:  
  13.     matchLabels:  
  14.       name: "mysql1"  
启动上述两文件

[html]  view plain  copy
  1. [root@k8s-master yaml]# kubectl apply -f glusterfs-pv.yaml   
  2. persistentvolume "gluster-dev-volume1" created  
  3. [root@k8s-master yaml]# kubectl apply -f glusterfs-pvc.yaml   
  4. persistentvolumeclaim "glusterfs-mysql1" created  
  5. [root@k8s-master yaml]# kubectl get pv  
  6. NAME                  CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM                      REASON    AGE  
  7. gluster-dev-volume1   10Gi       RWX           Retain          Bound     default/glusterfs-mysql1             8s  
  8. [root@k8s-master yaml]# kubectl get pvc  
  9. NAME               STATUS    VOLUME                CAPACITY   ACCESSMODES   AGE  

glusterfs-mysql1 Bound gluster-dev-volume1 10Gi RWX 6s

以上就完成了kubernetes配置glusterfs的全过程,下面我们通过运行mysql测试一下,编写mysql deployment yaml如下

[html]  view plain  copy
  1. [root@k8s-master yaml]# vi mysql-deployment.yaml   
  2. apiVersion: v1  
  3. kind: Service  
  4. metadata:  
  5.   name: mysql  
  6.   labels:  
  7.     name: mysql  
  8. spec:  
  9.   type: NodePort  
  10.   ports:  
  11.   - name: mysqlport  
  12.     port: 3306  
  13.     nodePort: 32006  
  14.   selector:  
  15.     name: mysql  
  16. ---  
  17.   
  18. apiVersion: extensions/v1beta1  
  19. kind: Deployment  
  20. metadata:  
  21.   name: mysql  
  22. spec:  
  23.   replicas: 1  
  24.   template:  
  25.     metadata:  
  26.       labels:  
  27.         name: mysql  
  28.     spec:  
  29.       containers:  
  30.         - name: mysqlcontainer  
  31.           image: docker.io/mysql  
  32.           imagePullPolicy: IfNotPresent  
  33.           env:  
  34.           - name: MYSQL_ROOT_PASSWORD  
  35.             value: root123456  
  36.           ports:  
  37.             - containerPort : 3306  
  38.           volumeMounts:  
  39.             - name: gluster-mysql-data  
  40.               mountPath: "/var/lib/mysql"  
  41.       volumes:  
  42.         - name: gluster-mysql-data  
  43.           persistentVolumeClaim:  
  44.             claimName: glusterfs-mysql1  

启动该文件

[html]  view plain  copy
  1. [root@k8s-master yaml]# kubectl apply -f mysql-deployment.yaml   
  2. service "mysql" created  
  3. deployment "mysql" configured  

查看状态

[html]  view plain  copy
  1. [root@k8s-master yaml]# kubectl get service  
  2. NAME                CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE  
  3. glusterfs-cluster   172.17.62.135    <none>        1/TCP            13m  
  4. kubernetes          10.254.0.1       <none>        443/TCP          6d  
  5. mysql               172.17.231.221   <nodes>       3306:32006/TCP   1m  
  6. [root@k8s-master yaml]# kubectl get pods  
  7. NAME                     READY     STATUS    RESTARTS   AGE  
  8. mysql-3736381796-5j11t   1/1       Running   0          1m  
  9. nginx-controller-1hxkz   1/1       Running   3          3d  
  10. nginx-controller-3xcl8   1/1       Running   3          3d  
  11. [root@k8s-master yaml]# kubectl get pods -o wide  
  12. NAME                     READY     STATUS    RESTARTS   AGE       IP            NODE  
  13. mysql-3736381796-5j11t   1/1       Running   0          1m        172.17.99.3   10.10.200.230  
  14. nginx-controller-1hxkz   1/1       Running   3          3d        172.17.99.2   10.10.200.230  
  15. nginx-controller-3xcl8   1/1       Running   3          3d        172.17.17.2   10.10.200.229  

登录mysql

[html]  view plain  copy
  1. [root@k8s-node2 ~]# mysql -h 10.10.200.230 -P 32006 -uroot -proot123456  
  2. Welcome to the MariaDB monitor.  Commands end with ; or \g.  
  3. Your MySQL connection id is 3  
  4. Server version: 5.7.20 MySQL Community Server (GPL)  
  5.   
  6. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.  
  7.   
  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  9.   
  10. MySQL [(none)]>   











分布式文件gluster集群化部署 一、集群化部署说明 1、本案例中glusterfs会挂载到k8s集群中。 2、为了避免容器化部署时出现问题,则k8s集群中的所有节点均需安装glusterfs的客户端。 3、glusterfs 必须使用和副本数数量倍数的节点.比如,我们创建的卷副本数为2,那么节点数需要是2的倍数.(节点数 = 副本数*N) 我们拟使用的副本数为2,节点使用10个.(避免影响主节点)。 4、glusterfs部署成功之后,在k8s集群中会挂载到指定目录。 4、注意: 在配置glusterfs之前,每个服务器均需要配 阅读详情

相关推荐

容器平台部署

一、基础系统配置 · 推荐内存2G/硬盘30G以上 · 最小化安装Ubuntu 16.04 server或者CentOS 7 Minimal · 配置基础网络、更新源、SSH登陆等 一、deploy节点 1.使用ntp服务器同步时间 Ubunt系统:sudo apt-get install ntp ntpdate #同步时间 ntpdate cn.pool.ntp.org #查询...

qq_33298926的博客 260

kubernetes动态存储之glusterfs集群(heketi)

kubernetes存储类资源的详细实现过程

taonihou_的博客 1373

VisionMaster图像源配置全攻略:从本地图片到相机SDK的保姆级教程

本文详细解析了VisionMaster图像源配置的三种主流方式:本地图片、相机直连和SDK集成。从像素格式选择到工业相机触发控制,再到SDK开发实战,提供全面的技术指导和避坑建议,帮助开发者高效实现图像处理应用的部署与优化。

yhn45678901的博客 781

kubernetes集群部署GlusterFS分布式文件系统

#1.metadata:data:EOF##2.metadata:true 2d23h定义文件如下,该PVC申请1G空间,StorageClass使用gluster-heketi。PVC一旦生成,系统便触发Heketi进行相应操作:1、GlusterFS集群上创建Brick,再创建Volume。

刘元林的博客 1661

cpp中auto, auto &和const auto &的区别

笔者初学cpp,如有纰漏,请见谅并指正。 用在哪 auto用于推断类型,具体可用于声明变量时根据初始化表达式自动推断该变量的类型,也就是可用在for循环。 也可以用于声明函数返回值的占位符。 怎么用 这里主要讲for循环中三者的区别 直接说结论 auto auto用于copy一份集合中的数据,对于这种情况,在循环体中不论怎么修改copy的数据,是不会影响到原有集合中的数据的。 举个简单的例子 int arr[5] = {0, 1, 2, 3, 4}; cout << "使用auto" <&

NinoSun的博客 3177

保姆级教程:手把手教你为STM32F407和W25Q128制作Keil MDK的SPI Flash下载算法(FLM文件)

本文提供了一份详细的教程,指导开发者如何为STM32F407和W25Q128制作Keil MDK的SPI Flash下载算法(FLM文件)。从理解下载算法的核心机制到实现FlashPrg.c的核心操作,再到链接脚本与地址映射实战,手把手教你完成定制化SPI Flash下载算法的开发与优化。

weixin_28716769的博客 409

使用GlusterFS作为Kubernetes的后端存储

用GlusterFS作为Kubernetes的存储 这里简单的介绍一下使用基于容器化的GlusterFS + heketi作kubernetes的后端存储的部署方式;对于GlusterFS的介绍这里就不多说了;部署过程主要参考:gluster-kubernetes 1、环境 [root@master-0 ~]# kubectl get nodes -o wide NAME STAT...

2469

ChatGPT Web转API工具:原理、部署与集成实战

在AI应用开发中,API(应用程序编程接口)是实现系统间通信和数据交换的核心技术,它通过标准化的请求响应机制,将复杂功能封装为可编程的服务。其工作原理基于HTTP协议,通过定义清晰的端点、方法和数据格式,使不同平台的应用能够高效集成AI能力。这一技术价值在于极大降低了开发门槛,促进了自动化流程和智能功能的快速落地,广泛应用于智能客服、内容生成和创意辅助等场景。本文聚焦于如何通过浏览器自动化技术,将ChatGPT的Web界面能力转化为标准API服务,其中涉及Playwright无头浏览器操作和会话Cookie

weixin_42533910的博客 1769

Kubernetes 对接 GlusterFS 磁盘扩容实战

入门级使用 Heketi Topology 扩容磁盘使用 Heketi CLI 扩容磁盘之前的实战课程,我们已经学习了如何在上安装部署 GlusterFS、Heketi 以及 Kubernetes 使用模式对接 GlusterFS 做为集群的后端存储。今天我们来实战模拟生产环境必然会遇到的一个场景,业务上线一段时间后 GlusterFS 数据盘满了,需要扩容怎么办?

KubeSphere 742

基于单片机控制的开关电源设计

采用开关电源技术和MCU模块,凭借可靠性高、易于调适的特点,可以更高效地发挥出二者的优势,从而实现更好的组合。stm32的起动模式是通过Boot0和Boot1两个管脚的高低电平来决定的,当stm32被供电之后,这两个管脚的电平。在 VCC上,键盘的一头(列线)被连接到 VCC上,而在“0”的编程输出中,则用来进。,在开关管打开的情况下,由输入电力供给电流,感应装置存储   Buck变换器是一种非隔离式的电压转换器[10]整流电路对输入电压进行整流,再经过滤波电路,即Dc电压是直流/直流变换器的直流输入。

QQ1694456187的博客 2313

PCL 最小生成树用于法向量定向【2025最新版】

PCL 最小代价生成树用于点云法向量的定向。博客长期更新,本文最近更新时间为:2025年9月15日。

点云侠的博客 2068

CentOS7下配置GlusterFS供Kubernetes使用

CentOS7下配置GlusterFS供Kubernetes使用 CentOS7下配置GlusterFS供Kubernetes使用 1. 环境说明 2. GlusterFS部署 3. 客户端使用GlusterFS 3.1 物理机上使用GlusterFS的volume 3.2 Kubernetes使用GlusterFS 3.2.1 创建GlusterFS端点定义 3.2.2 配置 servic...

ygqygq2的IT博客 765

深度学习100例-卷积神经网络(CNN)彩色图片分类 | 第2天

文章目录前期工作设置GPU导入数据标准化可视化构建CNN网络编译训练模型预测模型评估 前期工作 设置GPU 如果使用的是CPU可以忽略这步 import tensorflow as tf gpus = tf.config.list_physical_devices("GPU") if gpus: gpu0 = gpus[0] #如果有多个GPU,仅使用第0个GPU tf.config.experimental.set_memory_growth(gpu0, True) #设置GPU显存用量

“365天深度学习训练营”报名进行中~ 7856

二进制安装centos7安装glusterfs集群为kubernetes提供持久化存储,并作为kubesphere的默认存储

本次操作基于centos7,其它centos版本请参考: SpecialInterestGroup/Storage/gluster-Quickstart - CentOS Wikihttps://wiki.centos.org/SpecialInterestGroup/Storage/gluster-Quickstart 一、准备工作: 1、准备四台centos7的系统 我用的系统版本是centos7.6,除了k8s-master之外的节点都挂载一块硬盘,不要分区格式化。 主机ip 主机名

myitsite的博客 1750

BART non-Cartesian 重建:并行成像 压缩感知

本文主要使用并行成像和压缩感知方法实现non-Cartesian MRI 数据的重建。

张哥频道:电生理信号和磁共振成像 1182

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

qiangge 强哥 k8s1.15:第一次分步骤非kubeadm安装k8s 和各个组件

#安装常用插件 yum -y install net-tools lrzsz wget tree screen lsof tcpdump vim bash-completion telnet sysstat yum install -y bash-completion # base-completion.noarch补全 # 关闭防火墙: systemctl stop firewalld systemctl disable firewalld iptables -F # 关闭selinux:...

yuezhilangniao的博客 237

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

使用kubernetes方式部署glusterfs作为kubernetes持久化文件存储

准备四台虚拟机,系统使用centos7,并安装配置好kubernetes集群环境,本次实验使用kubeadm来安装单master多node集群。所有工作节点新挂在一块硬盘,不需要格式化。 [root@k8s-node1 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 100G 0 disk ├─sda1 8:1 0 300M 0 part /boot ├─sda2 8:2 0 3

myitsite的博客 1835

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

glusterfs中部署mysql_Centos7通过Kubernetes+GlusterFS部署wordpress+mysql

glusterfs 3.12.3操作步骤这里的配置步骤都是基于前几篇文章来的,就不详细说明了PV&PVC配置1.编写mysql pv yaml文件如下:[root@k8s-master yaml]# vi glusterfs-pv.yamlapiVersion: v1kind: PersistentVolumemetadata:name: wordpress-mysqllabels:nam...

weixin_39717865的博客 193

k8s glusterfs mysql_K8S中使用glusterfs

环境信息三台机器,操作系统CentOS 7.4:hanyu-210 10.20.0.210hanyu-211 10.20.0.211hanyu-212 10.20.0.212前提条件:已搭建K8S集群(1个master 2个node节点)1、搭建glusterFS集群(除非特别说明,否则三个节点都执行)执行[root@hanyu-210 k8s_glusterfs]# yum install...

weixin_42501161的博客 165

CentOS 7安装部署GlusterFS

CentOS 7安装部署GlusterFS 一、glusterfs简介 Glusterfs是一个开源的分布式文件系统,是Scale存储的核心,能够处理千数量级的客户端。是整合了许多存储块(server)通过Infiniband RDMA或者 Tcp/Ip方式互联的一个并行的网络文件系统。   特征: • 容量可以按比例的扩展,且性能却不会因此而降低。 • 廉价且使用简单,完全抽象在已有的文件系统之上。 • 扩展和容错设计的比较合理,复杂度较低 • 适应性强,部署方便,对环境依赖低,使...

Hello!C先生的博客 2464

glusterfs(分布式存储)部署

glusterfs(分布式存储)是企业中的主流部署形式 GlusterFS部署: 参考:http://docs.gluster.org/en/latest/Quick-Start-Guide/Quickstart/ # kubectl create -f glusterfs-endpoints.json # kubectl create -f glusterfs-service.json 准备: ...

机器重启员的博客 1031

使用heketi在kubernetes中安装glusterfs

环境及版本说明: centso7.6 k8s 1.17 glusterfs 7.1 集群只有三台机器 三台即作为客户端,也作为服务端。 加载内核模块(所有机器都要执行) modprobe dm_snapshot modprobe dm_mirror modprobe dm_thin_pool 添加一个硬盘,或者分一个新的分区(所有机器都要执行) fdisk /dev/sdb … (不能格...

划水的银开的博客 1186

Centos7 - kubernetes使用GlusterFS作为storageclass

k8s + clusterfs 进行storageclass自动创建PV。

vdon168的博客 655

k8s使用glusterfs(静态供给、动态供给)、glusterfs的安装与使用

k8s使用glusterfs(静态供给、动态供给)、glusterfs的安装与使用

MssGuo的博客 5776
上一篇: Kubernetes部署GlusterFS
下一篇: Gogs使用介绍
hxpjava1
博客等级 码龄19年 1365粉丝 511原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值