# Error when using mongo as tracker store

**URL:** <https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411>\
**Category:** Rasa Open Source\
**Created:** [October 7, 2019, 11:11am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411 "2019-10-07T11:11:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [October 7, 2019, 11:11am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/1 "2019-10-07T11:11:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ggabor](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ggabor/32/5292_2.png) [@ggabor](https://forum.rasa.com/u/ggabor)\
**Post date:** [October 7, 2019, 1:44pm UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/2 "2019-10-07T13:44:41Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [October 7, 2019, 3:09pm UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/3 "2019-10-07T15:09:29Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![ggabor](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ggabor/32/5292_2.png) [@ggabor](https://forum.rasa.com/u/ggabor)\
**Post date:** [October 7, 2019, 3:28pm UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/4 "2019-10-07T15:28:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vp109](https://avatars.discourse-cdn.com/v4/letter/v/c89c15/32.png) [@vp109](https://forum.rasa.com/u/vp109)\
**Post date:** [October 7, 2019, 4:02pm UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/5 "2019-10-07T16:02:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [October 8, 2019, 7:20am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/6 "2019-10-08T07:20:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [October 8, 2019, 7:22am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/7 "2019-10-08T07:22:17Z")

</div>

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

[docker-compose.yml](https://forum.rasa.com/uploads/short-url/hm57AMNdlhRwHnogMDT9YK3jFa1.yml) (2.1 KB)

---

<div class="post-metadata">

**Author:** ![vp109](https://avatars.discourse-cdn.com/v4/letter/v/c89c15/32.png) [@vp109](https://forum.rasa.com/u/vp109)\
**Post date:** [October 9, 2019, 4:09am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/8 "2019-10-09T04:09:26Z")

</div>

Hi @Asmacats.

Try changing your url in tracker\_store definition to `mongodb://mongo:27017` and running the instance.

---

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [October 9, 2019, 7:17am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/9 "2019-10-09T07:17:47Z")

</div>

Hi @vp109

I have tried it but does not work ☹

---

<div class="post-metadata">

**Author:** ![taguhi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@taguhi](https://forum.rasa.com/u/taguhi)\
**Post date:** [November 4, 2019, 9:07am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/10 "2019-11-04T09:07:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Asmacats](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/asmacats/32/21372_2.png) [@Asmacats](https://forum.rasa.com/u/Asmacats)\
**Post date:** [November 5, 2019, 9:03am UTC](https://forum.rasa.com/t/error-when-using-mongo-as-tracker-store/19411/11 "2019-11-05T09:03:59Z")

</div>

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
