Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如图,启动失败 #287

Closed
fafafafso opened this issue Oct 29, 2019 · 12 comments
Closed

如图,启动失败 #287

fafafafso opened this issue Oct 29, 2019 · 12 comments
Labels
good first issue Good for newcomers question Further information is requested

Comments

@fafafafso
Copy link

F91CF36C-5475-4C00-A790-934E6AE7C827

@tikazyq tikazyq added the good first issue Good for newcomers label Oct 29, 2019
@tikazyq
Copy link
Collaborator

tikazyq commented Oct 29, 2019

mongodb没有配置对,请参照文档配置

@fafafafso
Copy link
Author

.yml文件如下,docker-compose启动还是失败

version: '3.3'
services:
master:
image: tikazyq/crawlab:latest
container_name: crawlab-master
environment:
CRAWLAB_API_ADDRESS: "10.99.20.83:8000"
CRAWLAB_SERVER_MASTER: "Y"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
ports:
- "8080:8080" # frontend
- "8000:8000" # backend
depends_on:
- mongo
- redis
worker:
image: tikazyq/crawlab:latest
container_name: crawlab-worker
environment:
CRAWLAB_SERVER_MASTER: "N"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
CRAWLAB_SPIDER_PATH: ""
depends_on:
- mongo
- redis
mongo:
image: mongo:latest
restart: always
ports:
- "27017:27017"
redis:
image: redis:latest
restart: always
ports:
- "6379:6379"

@janlycn
Copy link

janlycn commented Nov 5, 2019

docker-compose首次启动成功,再次启动就会失败,日志显示 no reachable servers

@tikazyq
Copy link
Collaborator

tikazyq commented Nov 5, 2019

docker-compose首次启动成功,再次启动就会失败,日志显示 no reachable servers

有日志么

@janlycn
Copy link

janlycn commented Nov 8, 2019

docker-compose首次启动成功,再次启动就会失败,日志显示 no reachable servers

有日志么

worker | 2019/11/08 02:43:58 info 初始化配置成功
worker | 2019/11/08 02:43:58 info 初始化日志设置成功
worker | 2019/11/08 02:43:58 info 初始化定期清理日志配置成功
master | 2019/11/08 02:44:03 error init mongodb error:no reachable servers
master | goroutine 1 [running]:
master | runtime/debug.Stack(0x0, 0x0, 0x0)
master | /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master | runtime/debug.PrintStack()
master | /usr/local/go/src/runtime/debug/stack.go:16 +0x22
master | main.main()
master | /go/src/app/main.go:47 +0x2af
worker | 2019/11/08 02:44:03 error init mongodb error:no reachable servers
worker | goroutine 1 [running]:
worker | runtime/debug.Stack(0x0, 0x0, 0x0)
worker | /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
worker | runtime/debug.PrintStack()
worker | /usr/local/go/src/runtime/debug/stack.go:16 +0x22
worker | main.main()
worker | /go/src/app/main.go:47 +0x2af
worker | panic: no reachable servers
worker |
worker | goroutine 1 [running]:
worker | main.main()
worker | /go/src/app/main.go:48 +0x22b7
master | panic: no reachable servers
master |
master | goroutine 1 [running]:
master | main.main()
master | /go/src/app/main.go:48 +0x22b7
worker exited with code 2
master exited with code 2

偶尔启动会出现这样的问题,当前我的解决办法是在 docker-compose 配置加上 restart: always

@Bone117
Copy link

Bone117 commented Nov 12, 2019

docker-compose首次启动成功,再次启动就会失败,日志显示 no reachable servers

有日志么

worker | 2019/11/08 02:43:58 info 初始化配置成功
worker | 2019/11/08 02:43:58 info 初始化日志设置成功
worker | 2019/11/08 02:43:58 info 初始化定期清理日志配置成功
master | 2019/11/08 02:44:03 error init mongodb error:no reachable servers
master | goroutine 1 [running]:
master | runtime/debug.Stack(0x0, 0x0, 0x0)
master | /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master | runtime/debug.PrintStack()
master | /usr/local/go/src/runtime/debug/stack.go:16 +0x22
master | main.main()
master | /go/src/app/main.go:47 +0x2af
worker | 2019/11/08 02:44:03 error init mongodb error:no reachable servers
worker | goroutine 1 [running]:
worker | runtime/debug.Stack(0x0, 0x0, 0x0)
worker | /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
worker | runtime/debug.PrintStack()
worker | /usr/local/go/src/runtime/debug/stack.go:16 +0x22
worker | main.main()
worker | /go/src/app/main.go:47 +0x2af
worker | panic: no reachable servers
worker |
worker | goroutine 1 [running]:
worker | main.main()
worker | /go/src/app/main.go:48 +0x22b7
master | panic: no reachable servers
master |
master | goroutine 1 [running]:
master | main.main()
master | /go/src/app/main.go:48 +0x22b7
worker exited with code 2
master exited with code 2

偶尔启动会出现这样的问题,当前我的解决办法是在 docker-compose 配置加上 restart: always

解决了吗 同样的问题

@tikazyq
Copy link
Collaborator

tikazyq commented Nov 13, 2019

这是显示mongo连接不上的问题,需要将mongodb的连接配置正确

@guapier
Copy link

guapier commented Nov 14, 2019

解决了吗 同样的问题

@zj1842
Copy link

zj1842 commented Nov 25, 2019

同样的问题,有没有人怎么解决

@yann0917
Copy link
Contributor

同样的问题,找了老半天没找到解决方案 :
error log:

☁  crawlab [master] ⚡  dclf master
Attaching to master
master           |  * Starting nginx nginx
master           |    ...done.
master           | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
master           |
master           | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
master           |  - using env:	export GIN_MODE=release
master           |  - using code:	gin.SetMode(gin.ReleaseMode)
master           |
master           | 2019/11/28 14:40:34  info 初始化配置成功
master           | 2019/11/28 14:40:34  info 初始化日志设置成功
master           | 2019/11/28 14:40:34  info 初始化定期清理日志配置成功
master           | 2019/11/28 14:40:34 error init mongodb error:no reachable servers
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | main.main()
master           | 	/go/src/app/main.go:55 +0x2b2
master           | panic: no reachable servers
master           |
master           | goroutine 1 [running]:
master           | main.main()
master           | 	/go/src/app/main.go:56 +0x25a7

@tikazyq tikazyq added the question Further information is requested label Nov 29, 2019
@yann0917
Copy link
Contributor

同样的问题,找了老半天没找到解决方案 :
error log:

☁  crawlab [master] ⚡  dclf master
Attaching to master
master           |  * Starting nginx nginx
master           |    ...done.
master           | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
master           |
master           | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
master           |  - using env:	export GIN_MODE=release
master           |  - using code:	gin.SetMode(gin.ReleaseMode)
master           |
master           | 2019/11/28 14:40:34  info 初始化配置成功
master           | 2019/11/28 14:40:34  info 初始化日志设置成功
master           | 2019/11/28 14:40:34  info 初始化定期清理日志配置成功
master           | 2019/11/28 14:40:34 error init mongodb error:no reachable servers
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | main.main()
master           | 	/go/src/app/main.go:55 +0x2b2
master           | panic: no reachable servers
master           |
master           | goroutine 1 [running]:
master           | main.main()
master           | 	/go/src/app/main.go:56 +0x25a7

未添加 mongo 账号密码的时候,重启后成功,添加之后,启动不起来

crawlab错误信息:

master           | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
master           |  - using env:	export GIN_MODE=release
master           |  - using code:	gin.SetMode(gin.ReleaseMode)
master           |
master           | 2019/11/29 05:53:12  info 初始化配置成功
master           | 2019/11/29 05:53:12  info 初始化日志设置成功
master           | 2019/11/29 05:53:12  info 初始化定期清理日志配置成功
master           | 2019/11/29 05:53:12  info 初始化Mongodb数据库成功
master           | 2019/11/29 05:53:12  info 初始化Redis数据库成功
master           | 2019/11/29 05:53:12 error get scheduler list error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.(*Scheduler).Update(0xc000010600, 0x1, 0x1)
master           | 	/go/src/app/services/schedule.go:145 +0x3eb
master           | crawlab/services.(*Scheduler).Start(0xc000010600, 0xc000010600, 0x1)
master           | 	/go/src/app/services/schedule.go:79 +0x8a
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:169 +0xa3
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error update scheduler error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.(*Scheduler).Start(0xc000010600, 0xc000010600, 0x1)
master           | 	/go/src/app/services/schedule.go:81 +0x14e
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:169 +0xa3
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error start scheduler error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:171 +0x167
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error init scheduler error:command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | main.main()
master           | 	/go/src/app/main.go:72 +0x23bf
master           | panic: command find requires authentication
master           |
master           | goroutine 1 [running]:
master           | main.main()
master           | 	/go/src/app/main.go:73 +0x258f
master exited with code 2

mongo 错误信息:

mongo            | 2019-11-29T05:53:04.710+0000 I  NETWORK  [conn15] received client metadata from 172.22.0.4:53036 conn15: { driver: { name: "mgo", version: "globalsign" }, os: { type: "linux", architecture: "amd64" }, application: { name: "crawlab" } }
mongo            | 2019-11-29T05:53:04.721+0000 I  NETWORK  [conn15] end connection 172.22.0.4:53036 (3 connections now **open)**

  • docker-compose.yml 文件添加了mongo账号密码:
  mongo:
    image: mongo
    container_name: mongo
    ports:
      - 27017:27017
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME:  mongoadmin
      MONGO_INITDB_ROOT_PASSWORD:  mongoadmin
      MONGO_INITDB_DATABASE: crawlab
    volumes:
      - "/opt/crawlab/mongo/data/db:/data/db"
  • backend/conf/config.yml 文件修改了 mongo 的账号密码
api:
  address: "localhost:8000"
mongo:
  host: localhost
  port: 27017
  db: crawlab
  username: "mongoadmin"
  password: "mongoadmin"
  authSource: "admin"

@yann0917
Copy link
Contributor

同样的问题,找了老半天没找到解决方案 :
error log:

☁  crawlab [master] ⚡  dclf master
Attaching to master
master           |  * Starting nginx nginx
master           |    ...done.
master           | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
master           |
master           | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
master           |  - using env:	export GIN_MODE=release
master           |  - using code:	gin.SetMode(gin.ReleaseMode)
master           |
master           | 2019/11/28 14:40:34  info 初始化配置成功
master           | 2019/11/28 14:40:34  info 初始化日志设置成功
master           | 2019/11/28 14:40:34  info 初始化定期清理日志配置成功
master           | 2019/11/28 14:40:34 error init mongodb error:no reachable servers
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | main.main()
master           | 	/go/src/app/main.go:55 +0x2b2
master           | panic: no reachable servers
master           |
master           | goroutine 1 [running]:
master           | main.main()
master           | 	/go/src/app/main.go:56 +0x25a7

未添加 mongo 账号密码的时候,重启后成功,添加之后,启动不起来

crawlab错误信息:

master           | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
master           |  - using env:	export GIN_MODE=release
master           |  - using code:	gin.SetMode(gin.ReleaseMode)
master           |
master           | 2019/11/29 05:53:12  info 初始化配置成功
master           | 2019/11/29 05:53:12  info 初始化日志设置成功
master           | 2019/11/29 05:53:12  info 初始化定期清理日志配置成功
master           | 2019/11/29 05:53:12  info 初始化Mongodb数据库成功
master           | 2019/11/29 05:53:12  info 初始化Redis数据库成功
master           | 2019/11/29 05:53:12 error get scheduler list error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.(*Scheduler).Update(0xc000010600, 0x1, 0x1)
master           | 	/go/src/app/services/schedule.go:145 +0x3eb
master           | crawlab/services.(*Scheduler).Start(0xc000010600, 0xc000010600, 0x1)
master           | 	/go/src/app/services/schedule.go:79 +0x8a
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:169 +0xa3
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error update scheduler error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.(*Scheduler).Start(0xc000010600, 0xc000010600, 0x1)
master           | 	/go/src/app/services/schedule.go:81 +0x14e
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:169 +0xa3
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error start scheduler error: command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | crawlab/services.InitScheduler(0xc000092400, 0xcfe27f)
master           | 	/go/src/app/services/schedule.go:171 +0x167
master           | main.main()
master           | 	/go/src/app/main.go:70 +0x232b
master           | 2019/11/29 05:53:12 error init scheduler error:command find requires authentication
master           | goroutine 1 [running]:
master           | runtime/debug.Stack(0x0, 0x0, 0x0)
master           | 	/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
master           | runtime/debug.PrintStack()
master           | 	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
master           | main.main()
master           | 	/go/src/app/main.go:72 +0x23bf
master           | panic: command find requires authentication
master           |
master           | goroutine 1 [running]:
master           | main.main()
master           | 	/go/src/app/main.go:73 +0x258f
master exited with code 2

mongo 错误信息:

mongo            | 2019-11-29T05:53:04.710+0000 I  NETWORK  [conn15] received client metadata from 172.22.0.4:53036 conn15: { driver: { name: "mgo", version: "globalsign" }, os: { type: "linux", architecture: "amd64" }, application: { name: "crawlab" } }
mongo            | 2019-11-29T05:53:04.721+0000 I  NETWORK  [conn15] end connection 172.22.0.4:53036 (3 connections now **open)**
  • docker-compose.yml 文件添加了mongo账号密码:
  mongo:
    image: mongo
    container_name: mongo
    ports:
      - 27017:27017
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME:  mongoadmin
      MONGO_INITDB_ROOT_PASSWORD:  mongoadmin
      MONGO_INITDB_DATABASE: crawlab
    volumes:
      - "/opt/crawlab/mongo/data/db:/data/db"
  • backend/conf/config.yml 文件修改了 mongo 的账号密码
api:
  address: "localhost:8000"
mongo:
  host: localhost
  port: 27017
  db: crawlab
  username: "mongoadmin"
  password: "mongoadmin"
  authSource: "admin"

官方提供的镜像 tikazyq/crawlab:latest,里面的参数全都是默认的,代码及编译后的可执行文件也全都包含在内,自己只需提供一个docker-compose.yaml 文件即可开箱即用。
但是弊端是不能修改环境变量,不能修改代码。
所以基于Dockerfile 文件重新 build 一个镜像就解决这个问题了。

@tikazyq tikazyq closed this as completed Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants