noxma forum

Would you like to react to this message? Create an account in a few clicks or log in to continue.
noxma forum

noxma forum description


    MongoDb service

    avatar
    Admin
    Admin


    จำนวนข้อความ : 33
    Join date : 09/12/2017

    MongoDb service Empty MongoDb service

    ตั้งหัวข้อ by Admin Sat Dec 09, 2017 3:00 pm

    path : /opt/mongodb-linux-x86_64-ubuntu1604-3.4.4


    ##Setting up user authentication ##
    start mongod --config /<mongo.conf> (without --auth)
    run mongo --port 27017

    >use admin
    switched to db admin
    > db.createUser({user:"noxma",pwd:"noxma434", roles:[{role:"root",db:"admin"}]})
    > exit

    (Remark: other way in config file ,nano mongodb.conf)
    security:
    authorization: enabled



    ##Set auth option##
    ##Service Defination##
    /lib/systemd/system/mongodb.service

    ---------------------------------------------------------------
    [Unit]
    Description=mongo database service
    Requires=postgresql.service
    After=network.target postgresql.service

    [Service]
    Type=simple
    PermissionsStartOnly=true
    SyslogIdentifier=mongodb
    User=ubuntu
    Group=ubuntu
    ExecStart=/opt/mongodb-linux-x86_64-ubuntu1604-3.4.4/bin/mongod --auth --config /opt/mongodb-linux-x86_64-ubuntu1604-3.4.4/bin/mongod_nofork.conf
    WorkingDirectory=/opt/mongodb-linux-x86_64-ubuntu1604-3.4.4

    [Install]
    WantedBy=multi-user.target
    ---------------------------------------------------------------


    ##Command ###
    sudo systemctl status mongodb.service
    sudo systemctl start mongodb.service
    sudo systemctl stop mongodb.service

      เวลาขณะนี้ Sun May 12, 2024 10:49 am