1、部署ElasticSearch
Elasticsearch 是一个分布式的 RESTful 风格的搜索和数据分析引擎。用来做数据分析和检索的中间件。
它在kubesphere平台上的部署跟mysql和redis又有不同;下面我们来具体分析操作一下:
1.1、es容器启动
# 创建数据目录 mkdir -p /mydata/es-01 && chmod 777 -R /mydata/es-01 # 容器启动 docker run --restart=always -d -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms512m -Xmx512m" \ -v es-config:/usr/share/elasticsearch/config \ -v /mydata/es-01/data:/usr/share/elasticsearch/data \ --name es-01 \ elasticsearch:7.13.4
-e 为环境变量
-v 为数据卷挂载;一个是es产生的数据,另一个是es的配置。
–name:容器名称
1.2、es部署分析
注意: 子路径挂载,配置修改后,k8s不会对其Pod内的相关配置文件进行热更新,需要自己重启Pod
1.3、ElasticSearch的配置集
第一个文件挂载:elasticsearch.yml
第二个文件挂载:jvm.options
相当于一个es配置项中配置了两个配置文件:
## 文件名 elasticsearch.yml cluster.name: "docker-cluster" network.host: 0.0.0.0
## 文件名 jvm.options ################################################################ ## ## JVM configuration ## ################################################################ ## ## WARNING: DO NOT EDIT THIS FILE. If you want to override the ## JVM options in this file, or set any additional options, you ## should create one or more files in the jvm.options.d ## directory containing your adjustments. ## ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html ## for more information. ## ################################################################ ################################################################ ## IMPORTANT: JVM heap size ################################################################ ## ## The heap size is automatically configured by Elasticsearch ## based on the available memory in your system and the roles ## each node is configured to fulfill. If specifying heap is ## required, it should be done through a file in jvm.options.d, ## and the min and max should be set to the same value. For ## example, to set the heap to 4 GB, create a new file in the ## jvm.options.d directory containing these lines: ## ## -Xms4g ## -Xmx4g ## ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html ## for more information ## ################################################################ ################################################################ ## Expert settings ################################################################ ## ## All settings below here are considered expert settings. Do ## not adjust them unless you understand what you are doing. Do ## not edit them in this file; instead, create a new file in the ## jvm.options.d directory containing your adjustments. ## ################################################################ ## GC configuration 8-13:-XX:+UseConcMarkSweepGC 8-13:-XX:CMSInitiatingOccupancyFraction=75 8-13:-XX:+UseCMSInitiatingOccupancyOnly ## G1GC Configuration # NOTE: G1 GC is only supported on JDK version 10 or later # to use G1GC, uncomment the next two lines and update the version on the # following three lines to your version of the JDK # 10-13:-XX:-UseConcMarkSweepGC # 10-13:-XX:-UseCMSInitiatingOccupancyOnly 14-:-XX:+UseG1GC ## JVM temporary directory -Djava.io.tmpdir=${ES_TMPDIR} ## heap dumps # generate a heap dump when an allocation from the Java heap fails; heap dumps # are created in the working directory of the JVM unless an alternative path is # specified -XX:+HeapDumpOnOutOfMemoryError # specify an alternative path for heap dumps; ensure the directory exists and # has sufficient space -XX:HeapDumpPath=data # specify an alternative path for JVM fatal error logs -XX:ErrorFile=logs/hs_err_pid%p.log ## JDK 8 GC logging 8:-XX:+PrintGCDetails 8:-XX:+PrintGCDateStamps 8:-XX:+PrintTenuringDistribution 8:-XX:+PrintGCApplicationStoppedTime 8:-Xloggc:logs/gc.log 8:-XX:+UseGCLogFileRotation 8:-XX:NumberOfGCLogFiles=32 8:-XX:GCLogFileSize=64m # JDK 9+ GC logging 9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
1.4、创建es工作负载
选择es镜像:elasticsearch:7.13.4
使用默认端口
添加两个环境变量:
数据挂载:
第二个文件挂载:
点击下一步,创建成功
1.5、测试连接
进入自身容器终端
连接成功!
2、应用商店部署rabbitMQ
使用应用商店可以一键部署常用应用。
2.1、一键安装部署
点击安装
填写和选择相关信息后,点击下一步
点击安装,等待完成
2.2、创建外网访问服务
2.3、测试连接(成功)
游览器输入任意节点外网ip+端口号
目前kubesphere应用商店中只有38个应用。
3、应用仓库
- docker对应仓库是docker hub来管理docker的镜像仓库
- kubsphere对应的仓库 包管理是helm。
helm官网地址:https://helm.sh/
使用企业空间管理员登录,设置应用仓库
仓库相关学习 Helm即可,去helm的应用市场添加一个仓库地址,比如:bitnami。
3.1 添加企业仓库
3.2、从模板仓库部署应用zookeeper
等待创建zookeeper容器完成…
至此,zookeeper从应用市场bitnami中创建成功并运行!!
当你觉得自己很难的时候,说明你在走上坡路,别急,美好正在马不停蹄地赶来的路上。