wiki:mongodb

Version 2 (modified by Jamie McClelland, 5 years ago) ( diff )

--

MongoDB

May First/People Link does not officially support mongodb databases and does not make backups of databases created by users. However, if requested, we can setup a mongodb for you.

Admin steps

  • Install mongodb: apt install mongodb
  • Login: mongo mongodb://localhost:27017
  • Add admin user/password (save password in keyringer)
    db.createUser(
      {
        user: "useradmin",
        pwd: "xxxxxxxxxxxxxxxxxxxxxxxxP",
        roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
      }
    )
    
  • Logout (ctl-d)
  • Edit /etc/mongodb.conf and uncomment auth = true
  • Restart mongodb systemctl restart mongodb
  • Login again (this time with password) mongo -u useradmin -p mongodb://localhost:27017
  • Create requested database: use <dbname>
  • Create user account:
    db.createUser(
      {
        user: "<username>",
        pwd: "xxxxxxxxxxxxxxxxxxx",
        roles: [ { role: "readWrite", db: "<dbname>" } ]
      }
    )
    
  • Create file in user home directory with the credentials.
  • Test connection with:
    mongo -u <username> -p mongodb://localhost:27017/<db>
    
Note: See TracWiki for help on using the wiki.