Setting login information


#1

I’ve noticed that the default install of MapD attempts a force login of the default mapd user for the mapd database. As we tried to setup new databases and users, it was pretty hard to access them as loading Immerse in a browser would force log back into the mapd account. Once I changed the password, I now get kicked to the login page with an incorrect password error, and am then able to log into a different user.

However, as I keep doing out of habit, reloading the page or hitting enter in the browser URL forces a log out instead of staying logged in. I was wondering if there was a way to avoid that, and if not at least at a minimum, being able to change the auto user/pass/db information (as I do have the machine behind a firewall).

Much appreciated,


Low cost way to evaluate Mapd
Common config. for 3rd party tilemap?
#2

Hi

Thanks for your interest in MapD

The default behaviour when connecting to immerse can be controlled by a servers.json file.

How are you currently starting MapD. Are you using startmapd?

We would recommend for a more serious installation of MapD that you move to a systemd controlled MapD system with configuration files.

The steps to follow are:

  1. cd <mapd_home>/systemd/
  2. run ./install_mapd_systemd.sh
  3. During the process of answering the questions during running this script is to identify the MAPD_STORAGE directory
  4. After the script has run if you look in your MAPD_STORAGE directory you will see a default mapd.conf has been created
  5. Viewing that file it should contain some default starting information about your MapD install
port = 9091
http-port = 9090
data = "<MAPD_STORAGE>/data"

[web]
port = 9092
frontend = "<MAPD_PATH>/frontend"

At this point you can now control the MapD services with systemctl commands

to Start:
sudo systemctl start mapd_server
sudo systemctl start mapd_web_server

To check
sudo systemctl status mapd_server
sudo systemctl status mapd_web_server

To Stop
sudo systemctl stop mapd_server
sudo systemctl stop mapd_web_server

You will still be getting the auto login behaviour at this point

Now go in and edit your mapd.conf

In the [web] section add the line

servers-json = "<MAPD_STORAGE>/servers.json"

Create a file called servers.json in your MAPD_STORAGE directory

[
        {
                "username":"",
                "database":"",
                "password":""
        }
]

Now restart mapd_web_server
sudo systemctl restart mapd_web_server

At this point when you try to log onto immerse you will always be presented with a blank login screen asking you to enter all the details of where you want to connect to.

if you want to at least supply a default database you can populate the appropriate field
eg:
“database”:“mydb”,

A side note here is that you can use config files without having to use systemd, both mapd_server and mad_web_server will accept a --config parameter if for some reason you do not want to have to set up systemd

Regards


Mapd not support webservice and IFrame
#3

Many thanks, that servers.json did the trick perfectly of auto login. I was using systemctl for a bit but then decided to write a homegrown script to control the booting and rebooting, since for dev I like to have mapd_server running inside a screen as I can attach to see output as needed in a side term.

I noticed that once I got servers.json in place, login looks great; although I notice that when I’m on a dashboard and reload the page, it spits me back to login and then sends me to the dashboard listing page (instead of the dashboard I was on). I also saw that using the “share this link” url redirects directly back to the dashboard, so was curious if there’s a way to default replicate the same sort of passthrough that brings you right back to dashboard you were on if you reload.

For clarification of what we’re doing, we have a chrome extension that keeps a look on the open tab to see if there’s mouse activity… if the page isnt touched within 60s, we have the page reload (as we’re feeding in data to mapD in an automated stream system in the background), such that we’re trying to emulate our data set updating every 60s or so for an interactive in-house stats display. Obviously, i’d be even more open to having that auto data refresh functionality right in the dashboard, although I didn’t that as an option :slight_smile:


#4

Hi,

Glad it helped

Hmmm this will not get you all the way to where you want but

If you full populate the servers,json file (meaning fill in user password and db) you can also add

"loadDashboard": "My prefered dashboard"

and then it will take you straight to the particular dashboard you want, but it will always do it with the same user id and password etc which must be hardcoded in the servers.json


#5

Excellent, this should suffice for now :slight_smile: We have one of our frontend gurus doing some hacking of a copy of the default frontend (since I noticed you can specify different templates for frontend on load). Figured it would be interesting to see how we can finesse it. Would be more than happy to share our code if it’s useful.


#6

PS. Regarding your desire to see the running server output. You could just use
journalctl -f -u mapd_server
rather than having to run it in a window to see the ongoing output

Regards


#7

Thanks for the note… extremely helpful!


#8

Hi! If I need to manage multiple users, would you recommend adding them to the servers.json file ?

[
{
“username”:“user1”,
“database”:“db1”,
“password”:“pass1”
},
{
“username”:“user2”,
“database”:“db1”,
“password”:“pass2”
}

]

I am assuming that the password mentioned in the servers.json file and the one set inside the DB should be the same.

Are there any other parameters we can add into servers.json file.

_Ben


#9

Hi,

No, adding users to servers.json is not how you add more users to a DB.

If you want users to have to log in, you would remove the username and password from servers.json. This will cause immerse to start with a login and password screen. Each user would then login with their own credentials.

To create additional users see documentations here:

https://www.mapd.com/docs/latest/mapd-core-guide/users-and-databases/#create-user

regards


#10

I think there is an issue with setting up users on my end.

Here is what I did:

root@PDCUBUNT1:/data/mapd/data# /data/mapd/bin/mapdql -u mapd -p XXXX
User mapd connected to database mapd
mapdql> create user i2analyst (password = ‘XXXX’ );
Exception: User i2analyst already exists.
mapdql> drop user i2analyst ;
mapdql> create user i2analyst (password = ‘XXXX’);
mapdql> \q

User mapd disconnected from database mapd
root@PDCUBUNT1:/data/mapd/data# /data/mapd/bin/mapdql -u i2analyst -p XXXX
User i2analyst is not authorized to access database mapd
mapdql>

How do I provide this user ‘Read-only’ access to the mapd DB?

_Ben


#11

Hi,

Please refer to

https://www.mapd.com/docs/latest/mapd-core-guide/users-and-databases/#basic-database-security-example

There is no readonly controls on a user per user basis currently. Fine grained permissions will be arriving in the product very soon.

Regards


#12

Looks like I am still running into user setup issues.

I used mapdql to setup a user and successfully setup a user in the mapd DB. I can also see the user with the \u switch.

However when I return to the webUI, I get a new error message which says ‘*User xxxx is not authorized to access database mapd’

Looks like I might be missing another step. Please let me know.

_Ben


#13

Hi,

i suspect you are missing giving the user access to the database

run something like this as superuser to give a user access to a DB

ALTER USER user1 (INSERTACCESS = 'dbname');

regards


#14

Yup, that worked.

Thx Ben


#15

Dwayne, Is there a list of options documented at some place (refering to the INSERTACCESS = ‘dbname’ setting) for user setup ?

_Ben


#16

Hi,

There are only three options, password, is_super and INSERTACCESS (which really means all access to the identified DB)

https://www.mapd.com/docs/latest/mapd-core-guide/users-and-databases/?highlight=insertaccess#alter-user

Full table level privileges will be arriving in product very soon.

regards