ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
The Alteryx Community will be temporarily unavailable for a few hours due to scheduled maintenance starting on Thursday, April 22nd at 5pm MST. Please plan accordingly.

Alteryx Server Knowledge Base

Definitive answers from Server experts.

How to connect to MongoDB from the command line

MarkelioH
Alteryx
Alteryx
Created

This article explains how to connect to Alteryx Server MongoDB from the command line.


Prerequisites

  • Alteryx Server
    • All Versions

Procedure

When using embedded MongoDB

1. Run the command line as an Administrator



2. Change directories to the bin folder of your Alteryx installation. By default, the path is C:\Program Files\Alteryx\bin 
 cd "C:\Program Files\Alteryx\bin"
      



3. Open Alteryx System Settings

4. Navigate to Controller Persistence


5. Gather Password (not Admin Password) from Persistence section and save it for later use

idea Skyscrapers


6. Connect to AlteryxGallery database.
 mongo -u user -p PASTE_PASSWORD_FROM_STEP_5 -host localhost:27018 AlteryxGallery



Note: If you are not able to connect to the MongoDB shell, please make sure the Alteryx Service is running before trying to connect to the MongoDB and that the username and password are correct.

     
7. Connect to AlteryxGallery_Lucene database

 

 mongo -u user -p PASTE_PASSWORD_FROM_STEP_5 -host localhost:27018 AlteryxGallery_Lucene




8. Connect to AlteryxService database
 

 mongo -u user -p PASTE_PASSWORD_FROM_STEP_5 -host localhost:27018 AlteryxService

 



When using user-managed MongoDB



1. Run the command line as an Administrator



2. Change directories to the bin folder of your MongoDB installation. By default, the path is C:\Program Files\MongoDB\Server\[version]\bin
 cd "C:\Program Files\MongoDB\Server\3.0\bin"      


3. Open Alteryx System Settings.

4. Navigate to Gallery > Persistence.

5. Confirm whether "Use Controller Persistence Settings" is checked.


If yes, continue with the following steps otherwise move to Step 6.
  • Navigate to Controller Persistence in Alteryx System Settings
  • Take Password (Non-Admin Password). This will be your password to authenticate to AlteryxService and AlteryxGallery database. 
  • Make sure that MongoDB service is up and running before trying to connect to MongoDB


 
  • Use the password to connect to AlteryxGallery schema and AlteryxSerivice schema using the following commands
Note: By default, MongoDB listens on port 27017
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxService
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxGallery



6. If "Use Controller Persistence Settings" is unchecked, gather Password from Web Persistence and save it. This will be your password to authenticate to AlteryxGallery schema only. 

  • Connect to AlteryxGallery
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxGallery
 
7. Check whether "same settings as Web Persistence" is checked under Search Persistence section. 



If yes, continue with the following steps otherwise move to Step 8.
  • Take the password from Web Persistence seciton. You can use the same password to authenticate to AlteryxGallery_Lucene and AlteryxGallery.
  • Connect to AlteryxGallery_Lucene and AlteryxGallery
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxGallery_Lucene
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxGallery


8. If "same settings as Web Persistence" is unchecked, gather password from Search Persistence. This will be the password to authenticate to AlteryxGallery_Lucene only. 

  • Connect to AlteryxGallery_Lucene
 mongo -u PASTE_USERNAME -p PASTE_PASSWORD -host localhost:27017 AlteryxGallery_Lucene


When using Advanced User-Managed MongoDB 




1. Run the command line as an Administrator



2. Change directories to the bin folder of your MongoDB installation. By default, the path is C:\Program Files\MongoDB\Server\[version]\bin
 cd "C:\Program Files\MongoDB\Server\3.0\bin"      


3. Connect to AlteryxGallery. 
Note: You can use the same query to connect AlteryxService and Alteryx_Gallery_Lucene. 
 Mongo "mongodb://hostname:[port_number]/[schema_name]" -u user -p PASTE_PASSWORD"



 

Additional Resources