使用Kite和Kontrol进行分布式微服务

huangapple go评论90阅读模式
英文:

Distributed microservices using Kite and Kontrol

问题

我能够将我的风筝微服务注册到控制中心,但无法发现它。

kites, err := k.GetKites(&protocol.KontrolQuery{
    Username:    k.Config.Username,
    Environment: k.Config.Environment,
    Name:        "myservice",
})
if err != nil {
    fmt.Println("has error")
    log.Fatalln(err)
}

我得到了一个身份验证错误。

has error
2015/06/16 09:59:16 authenticationError: token contains an invalid number of segments
exit status 1

此外,我找不到$USER_HOME/.kite/kite.key文件。

英文:

I am able to register my kite microservice to kontrol but unable to discover it,

kites, err := k.GetKites(&protocol.KontrolQuery{
		Username:    k.Config.Username,
		Environment:k.Config.Environment,
		Name:"myservice",
	})enter code here
	if err != nil {
		fmt.Println("has error")
		log.Fatalln(err)
	}

I am getting authenticationError.

has error
2015/06/16 09:59:16 authenticationError: token contains an invalid number of segments
exit status 1

Also I am not able to find $USER_HOME/.kite/kite.key file.

答案1

得分: 1

我已经弄清楚了。我需要导出这些环境变量,

export KONTROL_PORT=4099
export KONTROL_USERNAME="kontrol"
export KONTROL_STORAGE="etcd"
export KONTROL_KONTROLURL="http://127.0.0.1:4099/kite"
export KONTROL_PUBLICKEYFILE=~/certs/key_pub.pem
export KONTROL_PRIVATEKEYFILE=~/certs/key.pem

然后生成 RSA 令牌,

cd ~/certs/
openssl genrsa -out key.pem 2048
openssl rsa -in key.pem -pubout > key_pub.pem
openssl rsa -in key.pem -pubout > key_pub.pem

使用 -install 标志运行 Kontrol CLI。

英文:

I have figured it out. I need to export these environment variable,

export KONTROL_PORT=4099
export KONTROL_USERNAME="kontrol"
export KONTROL_STORAGE="etcd"
export KONTROL_KONTROLURL="http://127.0.0.1:4099/kite"
export KONTROL_PUBLICKEYFILE=~/certs/key_pub.pem
export KONTROL_PRIVATEKEYFILE=~/certs/key.pem

Then generate rsa token,

cd ~/certs/
openssl genrsa -out key.pem 2048
openssl rsa -in key.pem -pubout > key_pub.pem
openssl rsa -in key.pem -pubout > key_pub.pem

Run Kontrol CLI with -install flag.

huangapple
  • 本文由 发表于 2015年6月16日 22:22:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/30870404.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定