▪Service Monitor Agent will be installed with MongoDB and it has dependencies on the third-party package zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel libffi-devel gcc. Run the rpm -qa|grep -E "zlib-devel|readline-devel|bzip2-devel|ncurses-devel|gdbm-devel|xz-devel|tk-devel|libffi-devel|gcc" command to check whether it has been installed on this Linux server. If it has not been installed yet, you can choose either option below to install the dependencies:
oOnline Install: run the yum -y install zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel libffi-devel gcc command to install it online.
oOffline Install: refer to Offline Installing Third-party Dependencies for more details.
Note: You can also install the Service Monitor Agent separately.
1.Log in to the Linux server as the root user.
Note: It is highly recommended to install numactl on this Linux Server to optimize MongoDB performance. Run the rpm -qa|grep numactl command to check whether it has already been installed. If it has not been installed yet and the Linux server has access to the Internet, run the yum install numactl command to install it online.
2.Run the mkdir command to create a directory under the /opt directory to place the installation package. For example, netbraintemp10.0.
Note: Do not place the installation package under any personal directories, such as /root.
3.Run the cd /opt/netbraintemp10.0 command to navigate to the /opt/netbraintemp10.0 directory.
4.Download the installation package.
▪Option 1: If the Linux server has no access to the Internet, obtain the mongodb-linux-x86_64-rhel-4.0.19-10.0.tar.gz file from NetBrain and upload it to the /opt/netbraintemp10.0 directory by using a file transfer tool.
▪Option 2: If the Linux server has access to the Internet, run the
wget <download link> command under the /opt/netbraintemp10.0 directory to directly download the mongodb-linux-x86_64-rhel-4.0.19-10.0.tar.gz file from NetBrain official download site.
Note: Contact NetBrain Support Team to get the download link. The download link is case-sensitive.
Tip: Run the yum -y install wget command to install the wget command if it has not been installed on the server.
5.Run the tar -zxvf mongodb-linux-x86_64-rhel-4.0.19-10.0.tar.gz command under the /opt/netbraintemp10.0 directory to extract installation files.
[root@centos netbraintemp10.0]# tar -zxvf mongodb-linux-x86_64-rhel-4.0.19-10.0.tar.gz
MongoDB/
MongoDB/config/
MongoDB/config/setup.conf
...
MongoDB/others/
MongoDB/others/install.conf
MongoDB/others/setup.conf.template
MongoDB/others/uninstall.sh
...
MongoDB/install.sh
...
6.Run the cd MongoDB/config command to navigate to the config directory.
7.Modify the parameters in the setup.conf file located under the config directory according to your environment and save the changes. For how to modify the configuration file, refer to Editing a File with VI Editor.
[root@centos config]# vi setup.conf
#NetBrain Database configuration file
#Note: Entries other than the database username and password
#can only contain letters or numbers, and should start with a letter.
DataPath=/usr/lib
LogPath=/var/log
BindIp=10.10.3.142
FQDN=127.0.0.1
#The port must be between 1025 and 32767.
Port=27017
ReplicaSetName=rs
UseSSL=no
Certificate=/etc/ssl/cert.pem
PrivateKey=/etc/ssl/key.pem
#The UserName or Password cannot be empty
#The UserName or Password should not contain: {}[]:",'|<>@&^%\ or a space.
#The length of UserName or Password should not be more than 64 characters.
UserName=admin
Password=Admin1.#
CPULimit=55%
MemoryLimit=55%
#List all replica set members. The members should be separated with spaces. The total number of members should be an odd number.
#The first member will be used as the primary member, the last will be used as the arbiter. The rest are the secondary members.
#It is recommended to use FQDN. The address of 0.0.0.0 or 127.0.0.1 is not allowed. For example:
#ReplicaSetMembers=192.168.1.1 192.168.1.2 192.168.1.3
ReplicaSetMembers=10.10.3.142
8.Run the cd .. command to navigate to the MongoDB directory.
9. Run the ./install.sh script under the MongoDB directory to install MongoDB as well as create the configured admin username and password for logging in to MongoDB. Configure the following parameters one by one with an interactive command line.
[root@centos MongoDB]# ./install.sh
INFO: Checking date.
INFO: Checking Linux OS version.
INFO: Starting to check if rpm exists.
INFO: MongoDB was not installed. Fresh installation is required.
INFO: Dependent Package:
INFO: Component Name: MongoDB
INFO: RPM name: mongodbconfig
INFO: RPM package list: mongodbconfig-4.0.19-el7.x86_64.rpm
INFO: Preprocessing SUCCEEDED
INFO: Collecting system information.
INFO: Collecting system information SUCCEEDED.
INFO: Checking systemd.
INFO: System checking SUCCEEDED
INFO: Username is admin
INFO: SSL enable status is no
INFO: Configuration parameters updating SUCCEEDED
INFO: Configuration parameters checking SUCCEEDED
Getting rpm dependency list of MongoDB and Service Monitor Agent...
INFO: Dependency list: zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel libffi-devel gcc
INFO: Component name: Service Monitor Agent
INFO: Service name: netbrainagent
INFO: Installation path: /usr/share/nbagent
INFO: Config path: /etc/netbrain/nbagent
INFO: Preprocessing SUCCEEDED.
INFO: Starting to install Service Monitor Agent ...
INFO: Starting to check system...
INFO: Collecting system information SUCCEEDED.
INFO: System checking SUCCEEDED.
INFO: Start dependencies checking...
INFO: Dependencies checking SUCCEEDED.
INFO: Starting to check configuration parameters...
Configuring Service Monitor Agent ...
The values in brackets are the default values of the parameters. To keep the default value for the current parameter,
press the Enter key.
Please enter the URL (must end with /) to call NetBrain Web API service for the Service Monitor [http(s):
//<IP address or hostname of NetBrain Application Server>/]: http://10.10.3.141/
Please enter the API Key to be used to communicate with application server which must be the same as the one created on Web API server:
Please re-enter API key to confirm:
Please enter a log path for NetBrain Service Monitor [/var/log/netbrain/nbagent]:
NetBrain Web API service URL: http://10.10.3.141/ServicesAPI
API key: ******
NetBrain Service Monitor LogPath: /var/log/netbrain/nbagent
Certificate Authority verification: no
Do you want to continue using these parameters? [yes]
...
INFO: Successfully logged in MongoDB with username: "admin", password: "******"
INFO: Backing up uninstall.sh SUCCEEDED
INFO: Successfully installed MongoDB
INFO: Please restart the operating system to make kernel settings of MongoDB to take effect.
Note: You'll need to use the interactive command line to install the Service Monitor Agent with MongoDB:
- The log path for Service Monitor Agent must have at least 10G free space. You can keep the default path or input your required path after inputting the URL and API key.
- If https:// is used in the Web API Service URL, you will be asked whether to enable the Certificate Authority verification and input the Certificate Authority file if enabled. The API Key is the key to be used later to install Web API Server and they must be same.
10. After MongoDB is successfully installed, run the reboot command to restart the machine.
11. After the machine starts, run the ps -ef|grep mongo or systemctl status mongod command to verify whether its service starts successfully.
[root@centos ~]# ps -ef|grep mongo
netbrain 46482 1 3 01:30 ? 00:00:03 /bin/mongod -f /etc/mongodb/mongod.conf
root 46639 37939 0 01:31 pts/2 00:00:00 grep --color=auto mongo
[root@localhost ~]# systemctl status mongod
mongod.service - MongoDB service
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-02-23 22:04:41 EST; 2min 41s ago
Process: 6136 ExecStart=/bin/mongod -f /etc/mongodb/mongod.conf (code=exited, status=0/SUCCESS)
Main PID: 6375 (mongod)
Memory: 902.3M (limit: 8.5G)
...
Note: When your disk space is insufficient for large amounts of logs, you can modify the log settings in the mongod.conf file under the /etc/logrotate.d directory.
Tip: You do not need to initialize NetBrain data in the MongoDB because the initialization will be automatically performed when you install the Web API Server or Worker Server later.
The following table describes the parameters that can be configured when installing MongoDB.
Parameter |
Default Value |
Description |
---|---|---|
DataPath |
/usr/lib |
Specify the storage path for all MongoDB data files. Note: Make sure the destination directory has more than 100GB free space to save all the data files. Tip: You can run the df -h command to check which directory has been mounted to a large disk. |
LogPath |
/var/log |
Specify the storage path for all MongoDB log files. Note: Make sure the destination directory has more than 50GB free space to save all the log files. |
BindIp |
127.0.0.1 |
Specify the IP address of MongoDB. Note: Don't use 127.0.0.1. Note: If you want to use the fully qualified domain name (FQDN) to connect to MongoDB, you need to set it as 0.0.0.0. Note: Select either to specify the actual value of BindIp or the FQDN for MongoDB by setting BindIp as 0.0.0.0. |
FQDN |
127.0.0.1 |
Specify the fully qualified domain name (FQDN) of MongoDB. Note: If you select to specify the FQDN for MongoDB, you must specify the FQDN in the ReplicaSetMembers parameter and when installing other components that require to connect to MongoDB. |
Port |
27017 |
Specify the port number that the MongoDB service listens to. It is recommended to keep the default value. Note: Each member in the replica set must have the same port number. |
ReplicaSetName |
rs |
Specify the replica set name used for replication. It is recommended to keep the default value. If you want to modify it, keep notes of your customized one because it is required to connect to MongoDB when you install other components, such as Web API Server, Worker Server, Task Engine, and Front Server Controller. Note: It can only contain letters and numbers, and must start with a letter. Note: Each member in the replica set must have the same replica set name, UserName, and Password. |
UseSSL |
no |
Specify whether to encrypt the connections to MongoDB with SSL. To enable SSL, replace no with yes. |
Certificate |
/etc/ssl/cert.pem |
Specify the name and storage path of the certificate file that contains the public key. Note: It is required only if UseSSL is enabled. |
PrivateKey |
/etc/ssl/key.pem |
Specify the name and storage path of the private key file. Note: It is required only if UseSSL is enabled. |
UserName |
admin |
Specify the admin username used to connect with and log in to MongoDB. Note: The value of the DBUser and DBPassword parameters cannot contain any of the following special characters, and their length cannot exceed 64 characters. |
Password |
Admin1.# |
Specify the admin password used to connect with and log in to MongoDB. |
CPULimit |
55% |
Specify the maximum CPU utilization that can be consumed by MongoDB. To make both MongoDB and Elasticsearch reasonably share the CPU resources of the same machine, the recommended value is 55%. |
MemoryLimit |
55% |
Specify the maximum memory capacity of the machine that can be consumed by the MongoDB. To make both MongoDB and Elasticsearch utilize the memory resources of the same machine, the recommended value is 55%. |
ReplicaSetMembers |
127.0.0.1 |
Enter the actual IP address to be bound or FQDN. |