Error when using mongo as tracker store

Hello,

I use rasa 1.2.7 and i would like to use MongoDB Tracker Store. I have followed the same instuction given in the doc but i have this error.

pymongo.errors.ServerSelectionTimeoutError: mongo:27017: [Errno -2] Name or service not known

My endpoint file is as follows:

tracker_store:

  • store_type: mongod
  • url: mongo
  • username: rasa
  • password: example

My mongo db image is

mongo:

  • image: mongo:latest
  • restart: always
  • container_name: mongo
  • hostname: mongo
  • environment: MONGO_HOST: ‘mongo’ MONGO_INITDB_ROOT_USERNAME: rasa MONGO_INITDB_ROOT_PASSWORD: example

Any help please?

Try changing your tracker_store’s details to this:

tracker_store:
  type: mongod
  url: mongodb://localhost:27017
  db: your_database_name
  username: your_username
  password: your_password

@ggabor When changing mongo by localhost, i have got this error pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused and when i put mongo, i got this error$ pymongo.errors.ServerSelectionTimeoutError: mongo:27017: [Errno -2] Name or service not known

Interesting. I use the details what I gave you and it works fine for me. Did you add the database name?

I may be shooting blind here but is your mongod running? Under Windows you can check it in the task manager (you can open it by pressing alt+ctrl+del and selecting Task Manager from the list) under the Services tab. Check if MongoDB’s status is Running. If not, you need to restart it by right-clicking on it and selecting Restart from the popup menu.

Looks like you’re trying to use docker-compose file. Do you mind copying your file and pasting for more details?
Just make sure you put the depends_on parameter in the docker-compose.yml for the container you want mongo container to be accessible from. And then retrain your bot.

@ggabor Thanks for your reposonse. The solution that you propose does not work for me as i run mongo in a dockoer compose.

@vp109 attached my file docker-compose.yml. Thanks for your help

docker-compose.yml (2.1 KB)

Hi @Asmacats.

Try changing your url in tracker_store definition to mongodb://mongo:27017 and running the instance.

Hi @vp109

I have tried it but does not work :frowning:

@Asmacats any progress on this? Cause I face the same problem now :confused:

Hi @taguhi

Yes i have solved the problem. Below the modified files

in the endpoints:

tracker_store: type: mongod url: mongodb://mongo:27017 db: rasa

in the docker-compose: mongo: image: mongo restart: always container_name: mongo networks: [‘rasa-network’] volumes: - “mongodbdata:/data/db” environment: MONGODB_DATABASE: rasa expose: - “27017” ports: - 37017:27017

mongo-express: image: mongo-express networks: [‘rasa-network’] restart: always depends_on: - mongo links: - mongo ports: - 8081:8081 environment: ME_CONFIG_MONGODB_ADMINUSERNAME: rasa ME_CONFIG_MONGODB_ADMINPASSWORD: example

volumes: mongodbdata: driver: local