我有:
当我点击开始时,我看到以下错误:
2016/04/21 19:31:31 [错误]代理:无法同步远程状态:rpc错误:无集群领导2016/04/21 19:31:44 [错误]代理:坐标更新错误:rpc错误:否集群领导者
我如何从这种状态恢复?
我有一个类似于如何从外部访问consul UI的问题,但我无法使网络选项组合正常工作.
我在OSX上使用Docker for Mac,而不是旧的docker-machine东西,以及官方的consul docker图像,而不是progrium/docker图像.
我可以使用启动3节点服务器群集
docker run -d --name node1 -h node1 consul agent -server -bootstrap-expect 3
JOIN_IP="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' node1)"
docker run -d --name node2 -h node2 consul agent -server -join $JOIN_IP
docker run -d --name node3 -h node3 consul agent -server -join $JOIN_IP
Run Code Online (Sandbox Code Playgroud)
到目前为止一切都很好,他们彼此联系并且工作正常.现在我想启动一个代理,并通过它查看UI.
我尝试了一堆-client和-bind的组合,这似乎是所有这一切的关键.运用
docker run -d -p 8500:8500 --name node4 -h node4 consul agent -join $JOIN_IP -ui -client=0.0.0.0 -bind=127.0.0.1
Run Code Online (Sandbox Code Playgroud)
我可以通过http:// localhost:8500/ui /获取UI ,并且consul成员显示所有节点:
docker exec -t node4 consul members …Run Code Online (Sandbox Code Playgroud) 我希望所有Azure Web应用程序服务以及Azure以外的资源都集中在一个地方。领事的关键价值存储似乎很合适(如果有其他更好的选择,我很高兴听到其他建议)。根据我对Consul的有限了解,每个节点都需要运行一个代理才能访问键值存储。
它是否正确?如果是这样,我该怎么做,是否可以通过Azure中的连续webjob进行?如果没有,如何在没有代理的情况下访问KV商店?
有一种新兴的趋势是将全局状态从传统的"静态"配置管理工具(例如Chef/Puppet/Ansible)中删除,而是将配置存储在某些集中/分布式工具中,其中主要参与者似乎是:
这些工具中的每一个都有不同的工作方式,但原理是相同的:
MY_APP")和环境(" DEV"," PROD"等).有一个优秀的Consul Java客户端,它可以很好地解释所有这些,并提供了充足的代码示例.
我对这些工具的理解是,它们建立在Zab,Paxos和Gossip等共识算法的基础之上,这些算法允许配置更新在整个节点中几乎以病毒式传播,最终保持一致.这样的想法存在,如果你有一个myapp有20个节点的应用程序,比如myapp01通过myapp20,如果你做一个配置改变其中之一,这种变化自然会"蔓延"遍及20个节点在一段秒/分钟.
我的问题是:这些更新如何实际部署到每个节点?在任何客户端API(我上面链接的那个,ZooKeeper API或Eureka API)中都没有看到某种回调功能,可以设置并用于在集中服务(例如领事)时通知客户端cluster)想要推送和重新加载配置更新.
所以我问:这应该如何工作(动态配置部署和客户端重装)?虽然Consul的API似乎是最先进的恕我直言,但我对这三种工具中的任何一种都有任何可行的答案感兴趣.
configuration-management consul netflix-eureka apache-zookeeper
我正在尝试使用 Zuul 和 Consul 创建一个 Spring 云微服务应用程序。
我的项目中有 2 个组件:
使用 Zuul 的 api-gateway 微服务
Hello world 微服务(一个简单的 hello world Rest Webservice)
这是 api-gateway 的代码:
@SpringBootApplication
@EnableZuulProxy
@EnableDiscoveryClient
public class ZuulApplication {
public static void main(String[] args) {
SpringApplication.run(ZuulApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
pom.xml
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M3</version>
</parent>
<properties>
<java.version>1.8</java.version>
<spring.cloud.consul.version>1.0.0.M4</spring.cloud.consul.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
<dependency>
<!-- Setup Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<!-- Setup Spring MVC & REST, use Embedded Tomcat -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> …Run Code Online (Sandbox Code Playgroud) 我在使用EC2,AWS,Docker,Consul-Template,Consul和NGINX进行一致的服务发现方面遇到了麻烦.
我有多个服务,每个服务都运行在自己的EC2实例上.在这些实例中,我运行以下容器(按此顺序):
自定义容器具有以下Dockerfile:
FROM nginx:1.9
#Install Curl
RUN apt-get update -qq && apt-get -y install curl
#Install Consul Template
RUN curl -L https://github.com/hashicorp/consul-template/releases/download/v0.10.0/consul-template_0.10.0_linux_amd64.tar.gz | tar -C /usr/local/bin --strip-components 1 -zxf -
#Setup Consul Template Files
RUN mkdir /etc/consul-templates
COPY ./app.conf.tmpl /etc/consul-templates/app.conf
# Remove all other conf files from nginx
RUN rm /etc/nginx/conf.d/*
#Default Variables
ENV CONSUL consul:8500
CMD /usr/sbin/nginx -c /etc/nginx/nginx.conf && consul-template -consul=$CONSUL -template "/etc/consul-templates/app.conf:/etc/nginx/conf.d/app.conf:/usr/sbin/nginx -s reload"
Run Code Online (Sandbox Code Playgroud)
app.conf文件如下所示:
{{range services}}
upstream {{.Name}} { …Run Code Online (Sandbox Code Playgroud) 我对这个配置有点困惑。我的 Spring Boot 应用程序@EnableDiscoveryClient已spring.cloud.consul.host设置为localhost. 我正在运行我的引导应用程序的主机上运行 Consul 代理,但我有几个问题(似乎无法在文档中找到我的答案)。
这个配置可以接受多个值吗?
@EnableDiscoveryClient?(这也感觉不对;一方面,即使一个代理应该能够告诉集群的所有信息,这似乎也是一个单点故障;如果我无法联系到这个代理怎么办?)有一种聪明的方法可以从容器内部获取 docker-compose 文件的服务(或容器)列表。
我不希望使用卷,或将撰写文件静态传递到容器并解析它或从环境变量传递包含这些信息的列表。
给出了一个完美的结果docker-compose config --service,它返回 compose 的所有服务的列表,但我不知道如何将它从主机传递给我的容器。
(我想获得它们组成我的应用程序的所有容器的列表,以便我可以使用registrator和consul监视哪些容器的上升和下降)。
我正在尝试利用 Consul .NET API 通过 TTL 注册和触发健康检查。首先,我使用以下代码注册我的服务:
var address = node.Address;
var id = ServiceId(address);
var registration = new AgentServiceRegistration
{
ID = id,
Name = node.ClusterName,
Address = node.Address.Host,
Port = node.Address.Port.Value,
Check = new AgentServiceCheck
{
TTL = settings.AliveInterval, // 10sec
DeregisterCriticalServiceAfter = settings.AliveTimeout, // 60sec
}
};
// first, try to deregister service, if it has been registered previously
await consul.Agent.ServiceDeregister(registration.ID);
await consul.Agent.ServiceRegister(registration);
Run Code Online (Sandbox Code Playgroud)
紧接着,我试图通过以下方式触发 TTL:
await consul.Agent.PassTTL("service:" + ServiceId(addr), string.Empty);
Run Code Online (Sandbox Code Playgroud)
但是,我最终得到的是 PassTTL 期间抛出的异常:Consul.ConsulRequestException: Unexpected response, status …
我不明白 consulxe2x80x99s agentapi 和consulxe2x80x99s api 之间的区别catalogapi
虽然consul文档一直强调agent和catalog不要混淆\xef\xbc\x8c,但是确实有很多看起来类似的方法,比如:
\n\n我什么时候应该使用catalog或agent\xef\xbc\x88 就像上面的 http url\xef\xbc\x89 一样?
哪一种适合高频次通话?
\nconsul ×10
docker ×3
spring-cloud ×2
.net ×1
amazon-ec2 ×1
azure ×1
c# ×1
macos ×1
mesos ×1
netflix-zuul ×1
nginx ×1
registrator ×1
spring-boot ×1