Elasticsearch-6.7.0系列(七)SpringCloud连接ES集群,使用ES用户名密码
pom.xml代码:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.joyce</groupId>
<artifactId>joyce-component-zipkin</artifactId>
<version>1.0</version>
<packaging>jar</packaging> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.20.RELEASE</version>
<relativePath />
</parent> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <dependencies>
<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency> <!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <!-- zipkin -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
<version>2.8.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<!-- zipkin --> <!-- 测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- <version>3.8.1</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
application.properties配置文件代码:
server.port=8740
spring.application.name=joyce-component-zipkin
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka,http://localhost:8762/eureka,http://localhost:8763/eureka
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true
eureka.instance.instance-id=${spring.application.name}:${server.port}
eureka.instance.prefer-ip-address=true #接受zipkin追踪,追踪数据会传导给turbine实时监控(如果存在)
spring.zipkin.enabled=true
spring.sleuth.feign.enabled=true
spring.sleuth.hystrix.strategy.enabled=true
spring.sleuth.sampler.percentage=1.0
spring.zipkin.base-url=http://joyce-component-zipkin ############################## ES单点连接 ######################
#zipkin.storage.type=elasticsearch
#zipkin.storage.elasticsearch.hosts=192.168.10.140:9200
#zipkin.storage.elasticsearch.max-requests=100
#zipkin.storage.elasticsearch.index=zipkin
#zipkin.storage.elasticsearch.index-shards=0
#zipkin.storage.elasticsearch.index-replicas=0 ############################## ES集群连接,使用用户名和密码 ######################
zipkin.storage.type=elasticsearch //使用elasticsearch存储zipkin追踪数据
zipkin.storage.elasticsearch.cluster=joyce-elasticsearch //集群的cluster name
zipkin.storage.elasticsearch.hosts=192.168.10.110:9200,192.168.10.120:9200,192.168.10.130:9200
zipkin.storage.elasticsearch.max-requests=100
zipkin.storage.elasticsearch.timeout=1000
zipkin.storage.elasticsearch.index=zipkin //存储zipkin数据时,ES的数据索引以zipkin为前缀,示例:zipkin-2019-06-09
zipkin.storage.elasticsearch.date-separator=- //ES索引数据的日期分隔符,默认为“-”
zipkin.storage.elasticsearch.index-shards=6 //集群的分片个数
zipkin.storage.elasticsearch.index-replicas=0 //集群的备(从)个数
zipkin.storage.elasticsearch.username=elastic //用户名
zipkin.storage.elasticsearch.password=1234567 //密码
zipkin.storage.type前缀注入到zipkin-autoconfigure-storage-elasticsearch-http-2.8.4.jar包里的TracingZipkinElasticsearchHttpStorageAutoConfiguration类。
@ConditionalOnBean(Tracing.class)
@ConditionalOnProperty(name = "zipkin.storage.type", havingValue = "elasticsearch")
@Configuration
class TracingZipkinElasticsearchHttpStorageAutoConfiguration {
zipkin.storage.elasticsearch前缀注入到zipkin-autoconfigure-storage-elasticsearch-http-2.8.4.jar包里的ZipkinElasticsearchHttpStorageProperties类。
@ConfigurationProperties("zipkin.storage.elasticsearch")
class ZipkinElasticsearchHttpStorageProperties implements Serializable {
SpringCloud启动类代码:
package com.joyce.zipkin; import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import zipkin.server.internal.EnableZipkinServer; @SpringBootApplication
@EnableZipkinServer
@EnableHystrix
@EnableHystrixDashboard
@EnableEurekaClient
public class ComponentZipkinApplication {
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ComponentZipkinApplication.class); public static void main(String[] args) {
SpringApplication.run(ComponentZipkinApplication.class, args);
}
}
Elasticsearch-6.7.0系列(七)SpringCloud连接ES集群,使用ES用户名密码的更多相关文章
- elasticsearch系列八:ES 集群管理(集群规划、集群搭建、集群管理)
一.集群规划 搭建一个集群我们需要考虑如下几个问题: 1. 我们需要多大规模的集群? 2. 集群中的节点角色如何分配? 3. 如何避免脑裂问题? 4. 索引应该设置多少个分片? 5. 分片应该设置几个 ...
- Elasticsearch-6.7.0系列(二)ES集群安装与验证
准备3台centos7机器/虚拟机,每台都安装上elasticsearch6.7.0 ,安装过程参考我的另一篇博客<Elasticsearch-6.7.0系列(一)9200端口 .tar.gz版 ...
- (七) Docker 部署 MySql8.0 一主一从 高可用集群
参考并感谢 官方文档 https://hub.docker.com/_/mysql y0ngb1n https://www.jianshu.com/p/0439206e1f28 vito0319 ht ...
- 大数据系列(5)——Hadoop集群MYSQL的安装
前言 有一段时间没写文章了,最近事情挺多的,现在咱们回归正题,经过前面四篇文章的介绍,已经通过VMware安装了Hadoop的集群环境,相关的两款软件VSFTP和SecureCRT也已经正常安装了. ...
- 一脸懵逼学习Hadoop分布式集群HA模式部署(七台机器跑集群)
1)集群规划:主机名 IP 安装的软件 运行的进程master 192.168.199.130 jdk.hadoop ...
- 生产环境elasticsearch5.0.1和6.3.2集群的部署配置详解
线上环境elasticsearch5.0.1集群的配置部署 es集群的规划: 硬件: 7台8核.64G内存.2T ssd硬盘加1台8核16G的阿里云服务器 其中一台作为kibana+kafka连接查询 ...
- Elasticsearch 搜索模块之Cross Cluster Search(跨集群搜索)
Cross Cluster Search简介 cross-cluster search功能允许任何节点作为跨多个群集的federated client(联合客户端),与tribe node不同的是cr ...
- mongo 3.4分片集群系列之三:搭建分片集群--哈希分片 + 安全
这个系列大致想跟大家分享以下篇章: 1.mongo 3.4分片集群系列之一:浅谈分片集群 2.mongo 3.4分片集群系列之二:搭建分片集群--哈希分片 3.mongo 3.4分片集群系列之三:搭建 ...
- K8S 搭建 Kafka:2.13-2.6.0 和 Zookeeper:3.6.2 集群
搭建 Kafka:2.13-2.6.0 和 Zookeeper:3.6.2 集群 一.服务版本信息: Kafka:v2.13-2.6.0 Zookeeper:v3.6.2 Kubernetes:v1. ...
随机推荐
- vue-router 的两种模式的区别
Vue Router 是Vue官方的路由管理器.它和 Vue.js 的核心深度集成,让构建单页面应用变得易如反掌.vue-router 默认 hash 模式,还有一种是history模式. hash模 ...
- C博客作业03——函数
0.展示PTA总分 截图展示: 1.本章学习总结 1.1学习内容总结 (a)函数的定义 1)函数是一个完成特定工作的独立程序模块,包括库函数和自定义函数两种,scanf(),printf()等为库函数 ...
- (4.1)打造简单OS-小实验[图形显示]
主要是实现<简单打造OS>第四小节说到的一个图形界面的实验项目 1.mbr boot.inc ;------------- loader和kernel ---------- LOADER_ ...
- Win10电脑桌面壁纸自动变成黑色无法更换怎么解决
很多用户在升级到win10之后,发现在使用过程中经常会碰到一些问题,就是电脑桌面壁纸总是会自动变成黑色,而且无法设置桌面背景壁纸,这是怎么回事呢,出现这样的问题可能是因为系统不是正版,或者是电脑设置不 ...
- 团队作业-Beta冲刺(2/4)
队名:软工9组 组长博客:https://www.cnblogs.com/cmlei/ 作业博客:https://edu.cnblogs.com/campus/fzu/SoftwareEngineer ...
- Eclipse创建Maven父子项目
Eclipse创建Maven父子项目 - 木头若愚 - CSDN博客https://blog.csdn.net/jay_1989/article/details/53906995 创建maven项目是 ...
- Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型
Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型 OxyPlot组件支持26种图表,这些图表按照功能和样式可以分为4大类,分别为线型图表.条型图表.金融图表和其它图表. 线型图表 ...
- git clone速度太慢的解决办法(亲测还有效)
https://www.linuxidc.com/Linux/2019-05/158461.htm 1.查找域名对应的ip地址,并修改hosts文件 linuxidc@linuxidc:~/linux ...
- date命令时间戳和时间之间的转换
这里是在mac下的操作,主要就是用date这个命令,更多的用法用man命令查看 字符串格式时间 TO 时间戳我们知道date 命令可以直接把当前时间转化为时间戳 # date +%s143678152 ...
- openresty开发系列33--openresty执行流程之3重写rewrite和重定向
openresty开发系列33--openresty执行流程之3重写rewrite和重定向 重写rewrite阶段 1)重定向2)内部,伪静态 先介绍一下if,rewrite指令 一)if指令语法:i ...