问题: 在做日志收集系统时使用到etcd,其中server端在linux上,首先安装第三方包(windows)(安装过程可能会有问题,我遇到的是连接谷歌官网请求超时,如果已经出现下面的两个文件夹并且文件夹中都有内容则可以不理会错误):

go get -u -v github.com/coreos/etcd/clientv3

完成之后,在开发环境中会增加两个文件夹:

. src\go.etcd.io
. src\github.com\coreos

客户端测试程序(go语言,命名为main.go,注意etcd server端的ip地址换成你自己的):

 package main

 import (
"fmt"
etcd_client "github.com/coreos/etcd/clientv3"
//etcd_client "go.etcd.io/etcd/clientv3"
"time"
) func main() { cli, err := etcd_client.New(etcd_client.Config{
Endpoints: []string{"192.168.30.136:2379", "192.168.30.136:22379", "192.168.30.136:32379"},
DialTimeout: * time.Second,
})
if err != nil {
fmt.Println("connect failed, err:", err)
return
} fmt.Println("connect succ")
defer cli.Close()
}

测试程序

在该文件夹下执行,报错如下:

go run main.go
F:\Go\project\src\go_dev_yuanma\go_dev\day12\etcd_conn>go run main.go
# github.com/coreos/etcd/clientv3
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.AuthEnable
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.AuthDisable
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.cal lOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserAdd
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserDelete
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.cal
lOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argumen
t to auth.remote.UserChangePassword
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.cal lOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argumen
t to auth.remote.UserGrantRole
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument
to auth.remote.UserGet
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument
to auth.remote.UserList
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.cal lOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argumen
t to auth.remote.UserRevokeRole
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: cannot use auth.call Opts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption)
as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument
to auth.remote.RoleAdd
..\..\..\..\github.com\coreos\etcd\clientv3\auth.go::: too many errors

这样的错误原因可以参考:

https://blog.csdn.net/zhangyexinaisurui/article/details/87001028

解决的办法:

1. 在 import 的时候,不要引用 "github.com/coreos/etcd/clientv3",而是 "go.etcd.io/etcd/clientv3",原因已在上面的链接有所说明:

//"github.com/coreos/etcd/clientv3"
"go.etcd.io/etcd/clientv3"

然后使用上面的测试程序测试,如果还有问题,再使用下面的 2 方法试下。

2. 可以到 github.com/coreos/etcd 地址下载所有的包,然后解压缩到 src\github.com\coreos 路径下,如果没有该目录则创建,并将解压后的文件夹命名为 etcd(原来为etcd-master),再将前面改名后的 etcd文件夹拷贝到 src\go.etcd.io 目录下,再使用测试程序测试下(测试前记着启动etcd的server端,同时测试程序 import "go.etcd.io/etcd/clientv3")。

参考文献:

  • https://blog.csdn.net/zhangyexinaisurui/article/details/87001028

搭建日志收集系统时使用客户端连接etcd遇到的问题的更多相关文章

  1. Kafka+Zookeeper+Filebeat+ELK 搭建日志收集系统

    ELK ELK目前主流的一种日志系统,过多的就不多介绍了 Filebeat收集日志,将收集的日志输出到kafka,避免网络问题丢失信息 kafka接收到日志消息后直接消费到Logstash Logst ...

  2. docker搭建日志收集系统EFK

    EFK Elasticsearch是一个数据搜索引擎和分布式NoSQL数据库的组合,提过日志的存储和搜索功能. Fluentd是一个消息采集,转化,转发工具,目的是提供中心化的日志服务. Kibana ...

  3. 快速搭建应用服务日志收集系统(Filebeat + ElasticSearch + kibana)

    快速搭建应用服务日志收集系统(Filebeat + ElasticSearch + kibana) 概要说明 需求场景,系统环境是CentOS,多个应用部署在多台服务器上,平时查看应用日志及排查问题十 ...

  4. 日志收集系统搭建-BELK

    前言 日志是我们分析系统运行情况.问题定位.优化分析等主要数据源头.目前,主流的业务系统都采用了分布式.微服务的形式.如果想要查看日志,就需要从不同的节点上去查看,而且对于整个业务链路也非常不清晰.因 ...

  5. 用ElasticSearch,LogStash,Kibana搭建实时日志收集系统

    用ElasticSearch,LogStash,Kibana搭建实时日志收集系统 介绍 这套系统,logstash负责收集处理日志文件内容存储到elasticsearch搜索引擎数据库中.kibana ...

  6. 日志收集系统ELK搭建

    一.ELK简介 在传统项目中,如果在生产环境中,有多台不同的服务器集群,如果生产环境需要通过日志定位项目的Bug的话,需要在每台节点上使用传统的命令方式查询,这样效率非常低下.因此我们需要集中化的管理 ...

  7. [转载] 一共81个,开源大数据处理工具汇总(下),包括日志收集系统/集群管理/RPC等

    原文: http://www.36dsj.com/archives/25042 接上一部分:一共81个,开源大数据处理工具汇总(上),第二部分主要收集整理的内容主要有日志收集系统.消息系统.分布式服务 ...

  8. Go实现海量日志收集系统(一)

    项目背景 每个系统都有日志,当系统出现问题时,需要通过日志解决问题 当系统机器比较少时,登陆到服务器上查看即可满足 当系统机器规模巨大,登陆到机器上查看几乎不现实 当然即使是机器规模不大,一个系统通常 ...

  9. 一共81个,开源大数据处理工具汇总(下),包括日志收集系统/集群管理/RPC等

    作者:大数据女神-诺蓝(微信公号:dashujunvshen).本文是36大数据专稿,转载必须标明来源36大数据. 接上一部分:一共81个,开源大数据处理工具汇总(上),第二部分主要收集整理的内容主要 ...

随机推荐

  1. FB面经Prepare: Dot Product

    Conduct Dot Product of two large Vectors 1. two pointers 2. hashmap 3. 如果没有额外空间,如果一个很大,一个很小,适合scan小的 ...

  2. UGUI血条跟随

    定义常量 public class Content { //当前UI分辨率 public const float UI_Width = 1366f; public const float UI_Hei ...

  3. warnings.warn("allowed_domains accepts only domains, not URLs. Ignoring URL entry %s in allowed_doma

    多页面循环爬取数据抛出如下异常 warnings.warn("allowed_domains accepts only domains, not URLs. Ignoring URL ent ...

  4. windows程序设计 获取磁盘容量

    //磁盘分区的总容量(字节)=总簇数*每簇扇区数*每扇区字节数 //磁盘分区的空闲空间(字节)=空闲簇数*每簇扇区数*每扇区字节数 BOOL GetDiskFreeSpace( LPCTSTR lpR ...

  5. jpa数据库表实体命名规则 Unknown column 'user0_.create_time' in 'field list'

    数据库,表字段命名是驼峰命名法(createTime),Spring data jpa 在操作表的时候,生成的sql语句中却是create_time, 表字段不对照, Spring data jpa基 ...

  6. IT题库3-线程实现的方式

    1.继承Thread类创建线程 Thread类本质上是实现了Runnable接口的一个实例,代表一个线程的实例.启动线程的唯一方法就是通过Thread类的start()实例方法.start()方法是一 ...

  7. 微信扫描二维码安卓弹出默认浏览器(苹果打开App Store)打开下载链接

    使用微信推广的用户经常都会遇到推广链接被拦截导致无法下载app的情况,此时用户在微信中打开会提示“ 已停止访问该网页 ”.这对于使用微信营销的商家来说就很不友好且损失非常大,因为用户是不知道为什么打不 ...

  8. Angular4 组件间通讯

  9. Java8比较器(Lamdba)

    1.首先构造一个实体以便示例使用 public class Developer { private String name; private BigDecimal salary; private in ...

  10. composer安装doctrine/dbal

    composer安装doctrine/dbal composer安装doctrine/dbal,安装不成功,使用的安装命令为官方提供命令“composer require doctrine/dbal” ...