community
cancel
Showing results for 
Search instead for 
Did you mean: 

alteryx server Knowledge Base

Definitive answers from Server experts.

Creating a User Managed MongoDB Instance

Alteryx
Alteryx
Created on

One of the three database options when setting up the Alteryx Server is to connect into a User-Managed MongoDB instance.  Why would you want to set up your own implementation of MongoDB?  The main benefits are to take advantage of the features of MongoDB that are not included with our embedded instance:

 

Replication - to provide data redundancy
Sharding - to distribute data over multiple servers

 

To start up your own MongoDB instance, you will first need to download the software.  For this article, I am going to mimic the setup we use for our current Alteryx Server, which is using MongoDB version 3.0.4.:

 

http://downloads.mongodb.org/win32/mongodb-win32-x86_64-3.0.4.zip
or
http://downloads.mongodb.org/win32/mongodb-win32-x86_64-3.0.4-signed.msi

 

Unzip or Install MongoDB in the folder of your choice. I will be using C:\MongoDB\3.0\bin for my own implementation. I am also creating two new folders:

 

C:\MongoDB\data - for the database
C:\MongoDB\log - for log files

 

Open two Windows Command Prompts as an administrator.  One we will use for the Mongo Service and the other for the Mongo Client, which I will refer as the Daemon and Client windows from now on.

 

runasadmin.jpg

 

 

 

 

 

 

In both windows change into your MongoDB bin directory:

cd \MongoDB\3.0\bin

 

Now, in the Daemon window, start up the MongoDB service:

mongod --dbpath C:\MongoDB\data

 

Look for the following line, it should be at the end of the start up dialog:

2017-01-31T09:02:04.472-0700 I NETWORK  [initandlisten] waiting for connections on port 27017

 

Switch over to the Client window and connect into the newly created database:

mongo localhost:27017

 

Now, create the admin database.  The use command allows you to switch into another database; if a database with the name you provided does not exist, MongoDB will create it for you:

use admin

 

Once inside the Admin database, create the default MongoDB administrator and authenticate the account:

db.createUser({user:"userAdmin", pwd:"password",roles:["root"]})


With the db.createUser() command we are creating the username we wish to use, the password for that user, and the database role for the account.  For more information on the types of roles available to MongoDB, take a look at the following URL: https://docs.mongodb.com/v3.0/core/security-built-in-roles/.  The db.auth() command authenticates the username and password to the database, allowing that user to log in with the provided credentials.

 

We can now restart MongoDB to use our new authentication.  First, let's exit out of the database and shut it down (keep both Command Windows open as we will still need them).  In the Client window, type the following:

exit

 

In the Daemon window, hit Ctrl+C on your keyboard to shut down the MongoDB service.  Restart the service back up with the --auth parameter to enable authentication:

mongod --dbpath C:\MongoDB\data --auth

 

In the Client window, let's log in to the admin database with our credentials:

mongo localhost:27017/admin -u userAdmin -p password

 

There are three databases we need to create: AlteryxService, AlteryxGallery, and AlteryxGallery_Lucene. We will create, add the same user account to each database, and authenticate the account:

use AlteryxService
db.createUser({user:'user', pwd:'password', roles:[{role:'readWrite', db:'AlteryxService'}]})

use AlteryxGallery
db.createUser({user:'user', pwd:'password', roles:[{role:'readWrite', db:'AlteryxGallery'}]})

use AlteryxGallery_Lucene
db.createUser({user:'user', pwd:'password', roles:[{role:'readWrite', db:'AlteryxGallery_Lucene'}]})


Here is an example of what to expect when running these commands:

connecting to: localhost:27017/admin

> use AlteryxService
switched to db AlteryxService
> db.createUser({user:'user', pwd:'password', roles:[{role:'readWrite', db:'AlteryxService'}]})
Successfully added user: {
        "user" : "user",
        "roles" : [
                {
                        "role" : "readWrite",
                        "db" : "AlteryxService"
                }
        ]
}
 
After creating the databases and user accounts, close down the MongoDB client:
exit

 

Feel free to close this Command Prompt as well.  We can also shut down the MongoDB daemon (Ctrl+C again - but keep this Command Prompt open) and create a Windows Service for MongoDB.  Open a text document and add the following text.  Modify any folder listings in your own document to match where you have MongoDB installed:

systemLog:
    destination: file
    path: C:\MongoDB\log\mongod.log
storage:
    dbPath: C:\MongoDB\data
net:
   port: 27017

 

For more information on the parameters you can set in this file, please visit https://docs.mongodb.com/v3.0/reference/configuration-options/.   Save the file in the root MongoDB folder you set up and name it mongod.cfg.  In the Command Prompt, run the following command making any modifications to the folder you installed MongoDB and the mongod.cfg file to:

"C:\MongoDB\3.0\bin\mongod.exe" --config "C:\MongoDB\3.0\mongod.cfg" --install

 

Be sure to include the full path for both files.  The Windows Services will not be able to find these files if you use relative pathing.  After entering the command, there will be a MongoDB entry in your Windows Services list.  Open the Windows Services and start up MongoDB.

 

Services.jpg

 

 

 

 

 

 

 

 

 

 

 

Now we can connect the Alteryx Service into our new User-Managed MongoDB instance:

  • Open the System Settings Configuration and click Next to Controller->Persistence
  • Select User-managed MongoDB from the Database Type
  • Enter in the Server name and port you have MongoDB installed on. On default, MongoDB will user 27017 to communicate
  • Enter in the Username and Password created for the AlteryxService database
sys settings_new.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Click Next through the rest of the configuration and Finish to restart the service.  When the Alteryx Service starts up, it will populate the database with the required collections.

Feel free to verify your Scheduler and Gallery instances are up and running.  If you experience any problems, please contact Alteryx Support.

 

Thanks to @GaryS@KevinP, and @ChristineB for proofreading and your advice.

Comments
Atom

I successfully followed these instructions and ran schedules locally.  However I received the following errors/warning during install.  Should these be addressed?

C:\Program Files\MongoDB\Server\3.0\bin>mongo localhost:27017

2017-04-03T16:10:33.423-0400 I CONTROL  Hotfix KB2731284 or later update is not

installed, will zero-out data files

MongoDB shell version: 3.0.4

connecting to: localhost:27017/test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

        http://docs.mongodb.org/

Questions? Try the support group

        http://groups.google.com/group/mongodb-user

2017-04-03T16:10:33.461-0400 I STORAGE  In File::open(), CreateFileW for 'X:\\.m

ongorc.js' failed with errno:3 The system cannot find the path specified.

Meteor

Is there a server spec that you'd recommend for the standalone Mongo instance?