京东云上centos8.2 安装 consul1.11.1
做个笔记下
--
前言
部分内容有参考网友的,但是地址不记得了!
安装内容基本参考官网的和上一个网友的
官网地址:
https://www.consul.io/downloads
以下是使用root方式安装的。
如果是consul,则建议先创建consul用户,再以consul登录
安装
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install consul
注意:root用户,省略sudu
配置
启动服务配置-修改启动文件consul.service
[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online.target
ConditionFileNotEmpty=/etc/consul.d/consul.hcl
[Service]
EnvironmentFile=/etc/consul.d/consul.env
User=root
Group=root
ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/
#不持久化 -dev
#ExecStart=/usr/bin/consul agent -dev -config-dir=/etc/consul.d/
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGTERM
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
--
consul参数配置
具体可以看 https://www.consul.io/docs/agent/options
可以命令行,可以是json,hcl之类的,主要是为了兼容老习惯
添加额外的参数文件(在/etc/consul.d/下添加sever.json,注意只要是json结尾即可,叫啥无所谓)
{
"datacenter": "dc1",
"data_dir": "/data/data/consul",
"log_level": "INFO",
"node_name": "foobar",
"server": true,
"ports": {
"http": 8500,
"https": -1,
"dns": 8600,
"grpc": -1,
"serf_lan": 8001,
"serf_wan": 8002,
"server": 8003
}
}
另外,这个版本中,有个默认的 /etc/consul.d/consul.hcl
修改几个参数:
# 任意客户端都可以链接--2021
client_addr = "0.0.0.0"
# 启动内置ui-web管理--2021dd
ui_config{
enabled = true
}
bind_addr = "0.0.0.0"
advertise_addr = "127.0.0.1"
# 指定只有一个节点,否则总是会提示 No cluster leader
bootstrap_expect=1
这些配置的大体意思就是 使用server模式(单节点)启动,web端口为8500,任意客户端可以连接!
最后看下启动后的界面

看下管理界面

最后,能不能用,还得通过springboot来验证:https://www.cnblogs.com/MrSi/p/13961890.html
--- 根据以上的提示
Springboot工程验证
1.使用sts创建一个springboot工程,pom配置如下
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.lzf</groupId>
<artifactId>vehicle-base</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>consul-test</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<!-- 添加热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<!-- 引入 Spring Boot Actuator 组件,因为需要通过它提供健康检查的接口给 Consul -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>
2.创建一个application.properties
#开发-热部署
spring.devtools.restart.enabled=true
server.port=8762
# Spring
spring.application.name=customer-service #actuator监控信息
info.app.name=应用服务器-8762
info.company.name=org.lzf
info.build.artifactId=cloud-customer
info.build.version=1.0-SNAPSHOT
#其余省略
3.创建一个boostrap.yml
spring:
cloud:
consul:
config:
enabled: true
format: YAML
data-key: data
watch:
enabled: true
prefix: config
discovery:
enabled: true
heartbeat:
enabled: true
health-check-interval: 5s
health-check-path: /actuator/health
instance-id: customer-service.8762
prefer-ip-address: true
enabled: true
host: 114.67.246.199
port: 8500
4.启动类记得加注解 @EnableDiscoveryClient
最后检测是ok的:

京东云上centos8.2 安装 consul1.11.1的更多相关文章
- 阿里云服务器 centos 7 安装postgresql 11
Postgresql简介 官方网站:https://www.postgresql.org/ 简介参考zhihu文章 https://www.zhihu.com/question/20010554 关于 ...
- 矩池云上nvidia opencl安装及测试教程
本教程租用的是2080ti,3.7多框架镜像. 添加nvidia-cuda的阿里源 curl -fsSL https://mirrors.aliyun.com/nvidia-cuda/ubuntu18 ...
- 矩池云上如何快速安装tensorRT
国内镜像 https://mirrors.cloud.tencent.com/nvidia-machine-learning/ubuntu1804/x86_64/ 检查系统版本 source /etc ...
- 矩池云上如何快速安装nvcc
若您想要使用 nvcc,但是所选的镜像中没有预装 nvcc,可按照如下操作自行安装. 1.检查系统版本 source /etc/os-release && echo $VERSION_ ...
- JAE京东云引擎Git上传管理代码教程和京东云数据库导入导出管理
文章目录 Git管理准备工作 Git工具上传代码 发布代码装程序 mywebsql管理 京东云引擎小结 JAE京东云引擎是京东推出的支持Java.Ruby.Python.PHP.Node.js多语 ...
- 干货 | 利用京东云Web应用防火墙实现Web入侵防护
摘要 本指南描述如何利用京东云Web应用防火墙(简称WAF),对一个简单的网站(无论运行在京东云.其它公有云或者IDC)进行Web完全防护的全过程.该指南包括如下内容: 准备环境 在京东云上准备Web ...
- 干货 | 运维福音——Terraform自动化管理京东云
干货 | 运维福音--Terraform自动化管理京东云 原创: 张宏伟 京东云开发者社区 昨天 Terraform是一个高度可扩展的IT基础架构自动化编排工具,主张基础设施即代码,可通过代码集中管 ...
- 干货 | 京东云Kubernetes集群+Traefik实战
摘要 Traefik支持丰富的annotations配置,可配置众多出色的特性,例如:自动熔断.负载均衡策略.黑名单.白名单.所以Traefik对于微服务来说简直就是一神器. 利用Traefik,并结 ...
- Developer Friendly | 基础设施即代码的事实标准Terraform已支持京东云!
Developer Friendly | 基础设施即代码的事实标准Terraform已支持京东云! Chef.Puppet.Ansible.SaltStack 都可以称为配置管理工具,这些工具的主要目 ...
- 京东云数据库 RDS助力企业便捷运维
iPhone6发布那年,京东在国贸等商圈送货最快速度数分钟,包括从下单到送达.这是一个极端的富含营销因素例子.即便如此,常态来看,隔天到货的这种业务模式,也是基于同样的支撑:营销业务.物流业务,大数据 ...
随机推荐
- dotnet C# 获取当前设备可移动磁盘
本文告诉大家如何获取当前设备的可移动磁盘 在我的 WPF 应用里面,期望获取到 U 盘的所在盘进行一些有趣的逻辑.可以通过 DriveInfo 类的 GetDrives 获取当前所有的驱动器磁盘 再通 ...
- Anaconda环境下GPT2-Chinese的基本使用记录
偶然在看到了这个项目,感觉很厉害,于是就折腾了下,跑了一跑 项目地址:https://github.com/Morizeyao/GPT2-Chinese 如果Github下载太慢的可以用这个代下载:h ...
- K8s包管理工具Helm v3(19)
一.Helm概述 官网:https://v3.helm.sh/zh/docs/ https://helm.sh/ helm 官方的 chart 站点: https://hub.kubeapps.com ...
- ansible(17)--ansible的archive和unarchive模块
1. archive模块 功能:在远端主机打包与压缩: 主要参数如下: 参数 说明 path 要压缩的文件或目录 dest 压缩后的文件 format 指定打包压缩的类型:bz2.gz.tar.xz. ...
- 26ObjectStream
ObjectStream ObjectOutputStream 用于将属性和内容保存到文件中,保存数据类型和值,即序列化,该流为处理流 static和transient修饰的属性无法序列化,切被序列化 ...
- ansible使用详解
ansible执行,用户主机配置 免密同一个同一个用户执行命令 1 能免密登录的[root@mcw1 ~]$ ansible 10.0.0.132 -m shell -a "hostname ...
- layui 新增行
layui表格新增行目前只在从内存加载数据的情况下可行! 在多方查找数据与实验后,我发现layui确实只能在直接赋值数据(从内存加载数据)的情况下新增行,即首次渲染表格时使用内存数据给表格的data参 ...
- Python 将PowerPoint (PPT/PPTX) 转为HTML
PPT是传递信息.进行汇报和推广产品的重要工具.然而,有时我们需要将这些精心设计的PPT演示文稿发布到网络上,以便于更广泛的访问和分享.本文将介绍如何使用Python将PowerPoint文档转换为网 ...
- quartzui 的界面管理
基于Quartz.NET3.0的定时任务Web可视化管理.docker打包开箱即用.内置SQLite持久化.语言无关.业务代码零污染.支持 RESTful风格接口.傻瓜式配置 quartzuiquar ...
- redis 的下载与安装
下载地址:https://github.com/MicrosoftArchive/redis/releases 选择免安装包: 解压到路径 D:\Redis-x64-3.0.504 用管理员权限打开 ...