[关闭]
@bergus 2016-03-21T20:52:47.000000Z 字数 1539 阅读 1847

consul 简单教程

consul


依赖命令: consul curl 我们的app

consul 运行

  1. nohup consul agent -dev >> consul.log &

本地服务注册

  1. curl -X PUT -d '{"Name":"user","Address":"127.0.0.1","Port":13001,"tags":["user prod-user.prod 13001"]}' -i http://localhost:8500/v1/agent/service/register
  2. curl -X PUT -d '{"Name":"diary", "Port": 13006, "Address":"127.0.0.1", "tags":["diary prod-diary.prod 13006"] }' -i http://localhost:8500/v1/agent/service/register
  3. curl -X PUT -d '{"Name":"mediastore", "Port": 13004, "Address":"127.0.0.1", "tags":["mediastore prod-mediastore.prod 13004"] }' -i http://localhost:8500/v1/agent/service/register
  4. curl -X PUT -d '{"Name":"other", "Port": 13003, "Address":"127.0.0.1", "tags":["other prod-other.prod 13003"] }' -i http://localhost:8500/v1/agent/service/register
  5. curl -X PUT -d '{"Name":"verification", "Port": 13002, "Address":"127.0.0.1", "tags":["verification prod-verification.prod 13002"] }' -i http://localhost:8500/v1/agent/service/register
  6. curl -X PUT -d '{"Name":"activity", "Port": 13005, "Address":"127.0.0.1", "tags":["verification prod-verification.prod 13005"] }' -i http://localhost:8500/v1/agent/service/register

本地服务运行并记录日志

  1. nohup /app/other.exe -dh prod-postgres.prod -du postgres -dpwd wothing -dn wothing >> other.log &
  2. cat other.log
  3. nohup /app/diary.exe -dh prod-postgres.prod -du postgres -dpwd wothing -dn wothing >> diary.log &
  4. nohup /app/mediastore.exe -p 13004 >> mediastore.log &
  5. nohup /app/user.exe -dh prod-postgres.prod -du postgres -dpwd wothing -dn wothing >> user.log &
  6. ls
  7. nohup /app/verification.exe -rh prod-redis.prod >> verification.log &
  8. nohup /app/activity.exe -dh prod-postgres.prod -du postgres -dpwd wothing -dn wothing >> activity.log &
  9. nohup /app/gw.exe >> gw.log &
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注