应用部署需要关注的信息【应用部署三要素】
1、应用的部署方式
2、应用的数据挂载(数据,配置文件)
3、应用的可访问性
一、MySQL
1、创建配置
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
2、创建存储卷
注意:如果没有安装nfs文件系统,需要提前安装一下,安装方法请参考附加内容
后面点击创建即可。
3、创建有状态应用
之后点击下一步 ==》 创建
4、配置负载均衡网络
- 自定义集群内服务名访问
在服务里面,删除原先的有状态副本集
创建
最后点击创建即可。
- 外网访问
创建
测试
二、Redis
1、创建配置
appendonly yes
port 6379
bind 0.0.0.0
点击创建即可
2、创建有状态应用
应用负载 ==》 工作负载
运行命名 redis-server
参数 /etc/redis/redis.conf
最后点击创建即可。
3、配置负载均衡网络
应用负载 ==》 服务
三、ElasticSearch
在任意节点上创建目录:
mkdir -p /mydata/es-01 && chmod 777 -R /mydata/es-01
1、创建配置文件
cluster.name: "docker-cluster"
network.host: 0.0.0.0
################################################################
##
## 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
2、创建有状态应用
应用负载 ==》 工作负载
elasticsearch:7.13.4
这个地方需要注意:
点击创建即可。
3、配置负载均衡网络
应用负载 ==》 服务
四、Nacos
1、创建配置
图片中的两个配置项请参考 nacos-2.0.3 版本,目录下conf
cluster.conf
ruoyi-nacos-v1-0.ruoyi-nacos.ruoyi.svc.cluster.local:8848
ruoyi-nacos-v1-1.ruoyi-nacos.ruoyi.svc.cluster.local:8848
ruoyi-nacos-v1-2.ruoyi-nacos.ruoyi.svc.cluster.local:8848
2、创建有状态应用
nacos/nacos-server:v2.0.3
这里需要配置一个健康检查:
3、配置负载均衡网络
五、Sentinel
1、创建有状态应用
leifengyang/sentinel:1.8.2
后面下一步点击创建即可。
2、配置负载均衡网络
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END