pidof systemd
2733
If this return a number then your system supports systemd. Most Linux distributions in 2017 support systemd.
Since systemd starts the process then all processes will be children of systemd
function btoa(str) { | |
if ((typeof str) !== 'string') { | |
str = JSON.stringify(str); | |
} | |
var buffer; | |
if (str instanceof Buffer) { | |
buffer = str; |
The find()
operator creates a cursor to the data. The client can then parse through the data and do calculations on the data for reports purposes. However, with large data sets this is not practical. It makes far more sense for the server to do the calculations and return the result. This can save a considerable amount of unnecessary network traffic. You can however run the count on the cursor without much overhead.
db.mycollection.find().count()
Mongo has two other methods for reporting on data:
Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.
We sould to set the hostname to match the name of the certificate we are going to optain.
sudo hostname mongo0.example.com
Then update the hostname file to set the server name permanently.
#MongoDB 3.2.x Security
##Network Ports The standard ports used by mongo are:
Process | Role | Default Port |
---|
The main log file is the mongod.log
. You can specify the log file location when you are starting the mongod process but if you have installed on Ubuntu from a package then you log file will normally be located in /var/log/mongodb/mongod.log
.
You can tail the log file using:
tail -f /var/log/mongodb/mongod.log
From the Mongo shell you can also view the log file using:
show logs
#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.
##Configuration Server Start the server on your server (myserver0)
mongod --configsvr --dbpath /data
On myserver1 start the shard giving the configuration server as the --configdb
option
#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.
To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.
##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application
#MongoDB 3.2.x
##Install MongoDB To install MongoDB on ubuntu from precompiled version.
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.5.tgz
gzip -d mongodb-linux-x86_64-ubuntu1404-3.2.5.tgz
tar -xvf mongodb-linux-x86_64-ubuntu1404-3.2.5.tar
Then check put what is in the bin directory