Rabu, 14 Maret 2018

How To Proceed Parse Server Dashboard Running Or Initiatory Of All At Organization Boot

Parse-Dashboard-

By-Default parse dashboard industrial plant until your final is active, in i lawsuit your connectedness intermission parse dashboard volition non endure available.
We tin move ii methods to proceed dashboard running always.

Method 1- Use nohup command.


Step 1- move nohup ascendence amongst parse dashboard
 Use nohup command to proceed running parse dashboard inwards the background. move the ascendence below.
Go to the parse dashboard directory-
 root@Server16: #  cd /opt/parse-dashboard
use nohup "parse command" &


root@Server16:/opt/parse-dashboard# nohup parse-dashboard --config parse-dashboard-config.json --allowInsecureHTTP imitation &

nohup ascendence volition proceed running parse dashboard inwards the background


Step 2- setup this ascendence to run at organization boot.
above ascendence volition aid us to run parse dashboard inwards the background but inwards illustration our server gets the reboot or crashed due to ability failure or other reason. In such case, nosotros postulate to brand certain to run our parse dashboard at organization kick up. follow the steps below to run dashboard at organization boot.

open in addition to edit rc.local file
root@Server16: # vi /etc/rc.local
Append the parse dashboard path in addition to then ascendence to offset parse dashboard. Add the ruby-red highlighted trace of piece of occupation to your rc.local, brand certain y'all are adding both the trace of piece of occupation earlier exit 0.
# In gild to enable or disable this script only alter the execution # bits. # # By default this script does nothing. #path of parse dashboard cd /opt/parse-dashboard # Command to offset parse dashboard inwards the backgroupnd nohup parse-dashboard --config parse-dashboard-config.json --allowInsecureHTTP imitation & exit 0 
Your file should endure similar to a higher identify inwards the screenshot

Method 2- Use PM2 npm module to offset parse dashboard.

We can  PM2 ascendence to start, halt in addition to banking concern fit the condition of parse dashboard. The wages is nosotros tin stop, offset in addition to banking concern fit the condition of our dashboard anytime. Follow the steps below to brand PM2 ascendence available inwards your environment.
Step 1- Install PM2
To install PM2 on your Linux machine move ascendence below.
sudo npm install -g pm2
Once pm2 installed, 
Step 2- Create parse-dashboard.json file.
create a script to brand parse dashboard available globally at Linux shell.
Create a parse-dashboard.json file using vim editor.
root@Server16: # vi parse-dashboard.json
Append the follow lines in addition to alter the highlighted trace of piece of occupation amongst your path
{   "apps" : [{     "name"        : "parse-dashboard-wrapper",     "script"      : "/usr/bin/parse-dashboard",     "watch"       : true,     "merge_logs"  : true,     "cwd"         : "/opt/parse-dashboard",     "args"         : "--config /opt/parse-dashboard/parse-dashboard-config.json --allowInsecureHTTP=1"   }] } 
Save in addition to driblet dead from the editor.
Step 3- Start parse dashboard.
root@Server16: # pm2 offset parse-deshboard.json
Parse dashboard is upward in addition to running.
Step 4- Check status:
root@Server16: # pm2 condition parse-deshboard.json
Step 4-Check condition of specific pm2 ID
To banking concern fit the item of ascendence move ID of running app
root@Server16: # pm2 demonstrate 0
In the screenshot below y'all volition detect Script path in addition to executed command.

Step 5- Mark pm2 ascendence execute during organization boot.
Your application volition endure available until the system is upward in i lawsuit your organization kick upward y'all in i lawsuit again postulate to run this ascendence to brand available your dashboard.
Let's laid upward our ascendence to execute during organization boot.
open in addition to edit rc.local file
root@Server16: # vi /etc/rc.local
Add the next trace of piece of occupation earlier exit 0 line
# bits. # # By default this script does nothing. #Start parse dashboard at organization kick upward pm2 offset /home/amar/parse-deshboard.json exit 0  
Save in addition to driblet dead from the file.

Now, your parse dashboard volition endure available if your organization gets the reboot.



Sumber https://linuxhowtoguide.blogspot.com/

Sabtu, 10 Maret 2018

Mongodb Basic Direction Command- Exercise Db, Exercise User, Assign Permission, Restrain Access

MongoDB:
MongoDB is an open-source document database that provides high performance, high availability, as well as automatic scaling. MongoDB obviates the involve for an Object Relational Mapping (ORM) to facilitate development.


  • Basic MongoDB admin related commands:
1- Check MongoDB server version:
Run below ascendance mongo to banking company gibe mongodb version
root@US16: # mongo MongoDB crunch version v3.6.0 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.0 
2-List all the database: To listing all the DBs hitting ascendance show dbs;
> show dbs; admin   0.000GB config  0.000GB local   0.000GB > 
3-Enable MongoDB authentication:
By default, mongodb installation convey opened upwards access to the shell. that hateful anyone tin forcefulness out run the ascendance as well as modify the dbs.

Let's enable authentication : Follow the steps below
3A-Create a user amongst total privileges: Run the next command 
use admin db.createUser({user:"admin", pwd:"redhat", roles:[{role:"root", db:"admin"}]})
Command output would hold upwards similar this:
source document database that provides high functioning Mongodb basic direction command- Create DB, Create User, Assign Permission, trammel access

Now leave of absence from the mongo shell- type ascendance exit
3B- Stop mongod service
root@US16: # systemctl halt mongod.service
3C-Modify /lib/systemd/system/mongod.service :

root@US16: # vi /lib/systemd/system/mongod.service
Append --quiet --auth syntax inwards trouble starting fourth dimension with 
ExecStart=/usr/bin/mongod --quiet --auth --config /etc/mongod.conf
[Service] User=mongodb Group=mongodb ExecStart=/usr/bin/mongod --quiet --auth --config /etc/mongod.conf # file size LimitFSIZE=infinity 
Your ExecStart trouble should hold upwards like 

Save as well as Exit from the file
4- Reload service daemon: Run the ascendance below
root@US16: # systemctl daemon-reload
5- Start mongo service:Run the ascendance below
root@US16: # systemctl starting fourth dimension mongod.service
6- Check mongo service status: We involve to validate mongo service afterward applied the changes let's banking company gibe mongo service condition using below command.
root@US16: # systemctl condition mongod.service
7- Everything hold off adept as well as mongo service is dorsum authentication has enabled, allow validate access.
7A- Access mongo crunch amongst authentication 
root@US16: # mongo -u root -p
We are successfully able to login amongst username as well as password!
8- List all users: Login to mongo crunch amongst admin user
select database admin
> utilisation admin
Execute the next ascendance show users; to listing users
> demo users; {         "_id" : "test.admin",         "user" : "admin",         "db" : "test",         "roles" : [                 {                         "role" : "root",                         "db" : "admin"                 }         ] } {         "_id" : "test.amar",         "user" : "amar",         "db" : "test",         "roles" : [                 {                         "role" : "root",                         "db" : "admin"                 }         ] } >  
In the higher upwards out at that spot are 2 user available highlighted inwards cerise color 
9- Check electrical flow selected database:
To banking company gibe electrical flow choose database utilisation ascendance db

> db admin > 
10- Check electrical flow selected database's collection:
 To banking company gibe electrical flow choose database's collection utilisation ascendance show collections

> demo collections system.users system.version > 
11- Update password for existing user:
Use the next ascendance to update existing user's password

> utilisation admin switched to db admin > db.changeUserPassword("amar", "newpassword") > 
Where "use admin" ascendance to choose database as well as db.changeUserPassword("username","Newpassword")



Sumber https://linuxhowtoguide.blogspot.com/