Monday, 15 February 2021
Mongodb3.4 installation
https://www.hugeserver.com/kb/install-mongodb-centos-6-7/
ION LOGIN
Tel: 1.888.842.8570E-mailLive Chat
Home
Dedicated Hosting
Dedicated Servers
Overview
Pricing
Los Angeles
Jacksonville
Meppel
Colocation
Overview
Custom Quote
Special Promotion
Virtual Hosting
Virtual Servers
Overview
Pricing
Hybrid Servers
Overview
Pricing
Virtualization
Solutions
Virtualization
Hardware Solutions
Software Solutions
Administration
Company
About Us
Company Overview
Our Team
Carriers
Blog
Contact
Partner Programs
Reseller Program
Referral
Datacenters
Overview
Los Angeles Datacenter
Jacksonville Datacenter
Meppel Datacenter
Why HugeServer
ION Platform
SLA Plus
Testimonials
Optimized Network
Knowledgebase
HugeServer Knowledgebase
HugeServer Knowledgebase > Linux > CentOS > Install MongoDB 3.4 on CentOS 6 and 7
Install MongoDB 3.4 on CentOS 6 and 7
on May 7, 2017 by AmirLeave a comment
Introduction
MongoDB is a scalable, high-performance, open source NoSQL database. The database is document-oriented so it manages collections of JSON-like documents. Many applications can thus model data in a more natural way, as data can be nested in complex hierarchies and still be queryable and indexable.
We are assuming that you have root permission, otherwise, you may start commands with “sudo”.
MongoDB Logo
Install MongoDB
For installing the latest stable version of MongoDB you should add MongoDB repository first.
Adding MongoDB Repository
Move to the following directory:
cd /etc/yum.repos.d/
Create the following file with your favorite text editor:
nano mongodb-org-3.4.repo
For the latest stable version of MongoDB paste the following line in the file then save and exit:
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Installing MongoDB
Update your repositories list executing the following command:
yum repolist
Now you can install the latest stable version of MongoDB using “Yum”:
yum install mongodb-org -y
Configuring SELINUX
If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems
If SELinux is in enforcing mode, enable access to the relevant ports that the MongoDB deployment will use (e.g. 27017).
semanage port -a -t mongod_port_t -p tcp 27017
Manage your MongoDB Service
You can manage your MongoDB service with “systemctl”:
For making MongoDB run at startup:
systemctl enable mongod
or
chkconfig mongod on
For Start/Stop MongoDB service:
systemctl start mongod
systemctl stop mongod
or
service mongod start
service mongod stop
See your MongoDB status:
systemctl status mongod
or
service mongod status
==========================================================================================================================================
===========================================================================================================================================
mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: false
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
wiredTiger:
engineConfig:
cacheSizeGB: 5
journalCompressor: none
collectionConfig:
blockCompressor: snappy
indexConfig:
prefixCompression: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
replication:
replSetName: WAPRS01
oplogSizeMB: 100
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
Tuesday, 12 February 2019
htaccess
RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^watch/(.*)$ red.php/$1/$2 [QSA,L]
RewriteRule ^watch1/(.*)$ red1.php/$1/$2 [QSA,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^nexgtv.com$
RewriteRule (.*) http://www.nexgtv.com/$1 [R=301,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
<files *.js>
SetOutputFilter DEFLATE
</files>
<files *.css>
SetOutputFilter DEFLATE
</files>
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^watch/(.*)$ red.php/$1/$2 [QSA,L]
RewriteRule ^watch1/(.*)$ red1.php/$1/$2 [QSA,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^nexgtv.com$
RewriteRule (.*) http://www.nexgtv.com/$1 [R=301,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
<files *.js>
SetOutputFilter DEFLATE
</files>
<files *.css>
SetOutputFilter DEFLATE
</files>
Monday, 31 December 2018
rsync with linuxsh file
#!/bin/bash
while true; do
#dt=`date`
#APP_NAME="wowza_analytics-"
#con1 ="-0220.tgz"
#rsync -arv /home/wowza_analytics_bcup/wowza_analytics/$APP_NAME-$con1 root@172.31.22.233:/home/manoj/101server/wowza_analytics_bcup/$APP_NAME-$con1 >/dev/null 2>&1
rsync -arv /home/wowza_analytics_bcup/wowza_analytics/. root@172.31.22.233:/home/manoj/101server/wowza_analytics_db_bcup/ >/dev/null 2>&1
#rsync -arv /data/www/html/unified/admin/banner/. root@172.31.22.50:/home/www/html/unified/admin/banner/ >/dev/null 2>&1
sleep 30
done
while true; do
#dt=`date`
#APP_NAME="wowza_analytics-"
#con1 ="-0220.tgz"
#rsync -arv /home/wowza_analytics_bcup/wowza_analytics/$APP_NAME-$con1 root@172.31.22.233:/home/manoj/101server/wowza_analytics_bcup/$APP_NAME-$con1 >/dev/null 2>&1
rsync -arv /home/wowza_analytics_bcup/wowza_analytics/. root@172.31.22.233:/home/manoj/101server/wowza_analytics_db_bcup/ >/dev/null 2>&1
#rsync -arv /data/www/html/unified/admin/banner/. root@172.31.22.50:/home/www/html/unified/admin/banner/ >/dev/null 2>&1
sleep 30
done
Monday, 17 December 2018
nodejs installation problem
REDIS CLI
https://www.linode.com/docs/databases/redis/install-and-configure-redis-on-centos-7/
===============================================
supervisor installation
https://stackoverflow.com/questions/45224707/install-and-config-supervisord-on-centos-7-to-run-laravel-queues-permanently
========================================================================
Node JS installation
(NPM Install) https://stackoverflow.com/questions/15890958/install-a-previous-version-of-a-package
(NVM)https://linuxize.com/post/how-to-install-node-js-on-debian-9/
http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module
https://www.linode.com/docs/databases/redis/install-and-configure-redis-on-centos-7/
===============================================
supervisor installation
https://stackoverflow.com/questions/45224707/install-and-config-supervisord-on-centos-7-to-run-laravel-queues-permanently
========================================================================
Node JS installation
(NPM Install) https://stackoverflow.com/questions/15890958/install-a-previous-version-of-a-package
(NVM)https://linuxize.com/post/how-to-install-node-js-on-debian-9/
https://www.liquidweb.com/kb/how-to-install-node-js-via-nvm-node-version-manager-on-centos-7/
https://tecadmin.net/install-nodejs-with-nvm/(NVM)
https://tecadmin.net/install-nodejs-with-nvm/(NVM)
https://stackoverflow.com/questions/14948179/how-to-make-nvm-automatically-sourced-upon-login
http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module
For anyone else running into this, I had this problem due to my
npm installing into a location that's not on my NODE_PATH.
My NODE_PATH was empty, and running npm install --global --verbose promised-io showed that it was installing into /opt/lib/node_modules/promised-io:
My script fails on require('promised-io/promise'):
I probably installed node and npm from source using configure --prefix=/opt.
I've no idea why this has made them incapable of finding installed
modules. The fix for now is to point NODE_PATH at the right directory:
My require('promised-io/promise') now succeeds.================================================= Node command 476 yum install pm2 477 npm install pm2 -g 478 npm install pm2@latest -g 479 pm2 list 480 yum install memcached 481 yum install redis-tools 482 git clone http://github.com/antirez/redis.git 483 cd redis && git checkout 3.0 484 make redis-cli 485 redis-cli 486 make redis-cli 487 ln -s src/redis-cli /usr/local/bin/redis-cli 488 redis-cli 489 cd /usr/src 490 wget -c http://download.redis.io/redis-stable.tar.gz 491 redis-cli 492 yum install redis-cli 493 tar xvzf redis-stable.tar.gz 494 cd redis-stable 495 make && make install 496 Install the Redis script0 redis-server 501 redis-cli programme_schedule '*' 502 redis-cli monitor 503 telnet localhost 6379 504 chkconfig redis on 505 /etc/init.d/redis_6379 start 506 yum install redis 507 yum install make gcc wget 508 cd tools 509 wget http://download.redis.io/releases/redis-3.0.2.tar.gz 510 tar -zxvf redis-3.0.2.tar.gz 511 cd redis-3.0.2 512 ll 513 make 514 make install 515 cd utils/ 516 ./install_server.sh 517 chkconfig redis on 518 etc/init.d/redis_6379 start 519 /etc/init.d/redis_6379 start 520 chkconfig redis on 497 redis-cli 498 redis-server chkconfig redis_6379 on 522 redis-cli 523 /etc/init.d/redis_6379 stop 524 /etc/init.d/redis_6379 start 525 chkconfig redis on 526 chkconfig redis_6379 on 527 reboot 528 yum intall memcache 529 yum update 530 ps ax | grep yum 531 kill -9 2814 532 ping yahoo.com 533 vim /etc/resolv.conf 534 yum install telnet 535 ps ax | grep yum 536 kill -9 2870 537 cd /etc/yum.repos.d/ 538 ls 539 rm mongodb-org.repo 540 yum cleana ll 541 yum update 542 vim /etc/resolv.conf 543 ps ax | grep yum 544 kill -9 2970 545 nslookup 546 yum update 547 yum clean all 548 yum repolist 549 yum install yum-utils 550 yum install telnet 551 yum install memcache 552 yum install memcached 553 clear 554 df 555 df -h 556 free -m 557 clear 558 df 559 cd /home 564 redis-cli 565 service memcached start 566 service memcache start 567 yum install memcached 568 yum install telnetd 569 service memcahed start 570 service memcahe start 571 yum install memcached 572 service memcached start 573 pm2 start scheduleworker.js -n cathcup 574 pm2 list 575 pm2 strat 576 pm2 list 577 cd /etc 578 pm2 579 npm install pm2@latest -g 580 npm -v 581 nvm ls 582 node -v 583 vpm -v 584 npm -v 587 node -v 588 npm -v 589 nvm install node 590 node -v 591 npm -v 592 npm install pm2 -g 593 pm2 install 594 reboot 595 service memcached start 596 chkconfig memcached on 597 service memcached start 598 chkconfig memcached on 599 chkconfig memcache on 600 pm2 list 601 npm -v 602 npm install pm2 -g 603 node -v 604 command -v nvm 605 nvm install node 606 node -v 607 chkconfig npm on 608 chkconfig nvm on 609 chkconfig node on 610 top -d 2 611 command -v nvm 612 npm install pm2 -g 613 pm2 install 614 chkconfig pm2 on 615 systemctl enable pm2 616 systemctl enable mpm 617 systemctl enable npm 618 systemctl enable node 619 node -v 620 sudo pm2 startup systemd 621 systemctl enable nodeserver.service 622 systemctl start nodeserver.service 623 systemctl status nodeserver.service 624 npm install pm2 -g 625 pm2 list 626 node 627 pm2 save 628 node -v 629 which node 630 redis-cli 631 reboot 632 pm2 list 633 nvm list 634 yum uninstall --force node 635 uninstall node 636 yum uninstall node 637 yum rm -rf node* 638 rm -rf /usr/local/share/man/man1/node.1 639 rm -rf /usr/local/lib/dtrace/node.d 640 rm -rf ~/.npm 641 nvm 642 mpn -v 643 npm -v 644 npm cache clean -f 648 nvm ls 649 nvm use 0.11.16 650 nvm install stable 651 nvm use 0.11.16 652 nvm deactivate 653 nvm uninstall 10.2.1 654 nvm use 0.11.16 655 nvm install stable 656 nvm ls 657 nvm deactivate 658 nvm ls 659 nvm uninstall 10.2.1 660 nvm ls 666 node -v 667 ifconfig -a 668 npm -v 669 npm install pm2 -g 670 pm2 install 671 pm2 save 672 pm2 list 673 pm2 startup 674 pm2 save 675 pm2 startup 676 pm2 list 677 cd /etc/scripts 678 ls 679 cd digiapis 680 pm2 startup 681 yum install pm2 682 pm2 list 683 pm2 startup 684 npm install pm2@latest -g 685 node -v 686 npm -v 687 yum install npm 688 yum install node 703 echo $NODE_PATH 704 npm install --global --verbose promised-io 705 npm install --global --verbose 706 which node 707 nvm install 0.11 708 nvm current 709 nvm install stable 710 nvm current 711 v0.12.2 (npm v2.7.4) 712 nvm ls 713 which node 714 echo $NODE_PATH 715 npm install --global --verbose 716 npm install --global --verbose promised-io 717 node -v 718 nvm current 719 locate nvm.sh 720 locate .bash_profile 721 vim /root/.bash_profile 722 npm -v 723 nvm ls 724 nvm alias default v0.11.16 725 nvm ls 726 nvm alias default v0.11.16 727 nvm ls 728 npm install pm2@latest -g 729 pm2 startup 730 pm2 list 731 service memcached status 732 node -v 733 reboot 734 npm -v 735 node -v 736 pm2 list 737 npm install pm2@latest -g 738 pm2 list 739 pm2 startup 740 pm2 save 741 reboot 742 passwd 743 ps ax 744 exit 745 top 746 node -v 747 npm -v 748 pm2 list 749 ssh-keygen 750 cd /root/.ssh 751 npm -v 752 cd /etc/scripts 753 ll 754 cd digiapis 755 pm2 start scheduleworker.js -n cathcup 756 cd epgrecording 757 pm2 start scheduleworker.js -n cathcup 758 cd /etc/scripts/epgrecording 759 pm2 start scheduleworker.js -n cathcup 761 ll 762 cd digiapis 763 ll 764 crontab -l 765 pm2 start app.js -n digiapis -i 0 766 pm2 logs 767 top 768 crontab -e 769 * /root/.nvm/versions/node/v7.10.0/bin/node /etc/scripts/epgrecording/index.js 770 nvm ls 771 locate v0.11.16 772 locate .nvm 773 nvm ls 774 /root/.nvm/versions/node/ v10.2.1/bin/node /etc/scripts/epgrecording/index.js 775 /root/.nvm/versions/node/v10.2.1/bin/node /etc/scripts/epgrecording/index.js 776 crontab -e 778 nvm current 779 nvm use v7.10.0 780 nvm install v7.10.0 && nvm use v7.10.0 && nvm alias default v7.10.0 781 nvm -v 782 mpm -v 783 npm -v 784 nvm -v 785 ls -v 786 nvm ls 787 pm2 list 788 locate .bash_profile 789 vim /root/.bash_profile 790 npm install pm2@latest -g 791 pm2 startup 792 pm2 save 793 cd epgrecording 794 cd /epgrecording 795 cd /etc/scripts/epgrecording 796 pm2 start scheduleworker.js -n cathcup 797 reboot 798 npm -v 799 node -v 800 pm2 list 801 pm2 logs 802 crontab -e 803 pm2 logs 804 crontab -e 805 pm2 logs 806 date 807 clock 808 pm2 logs 809 ping digi2.nexg.tv 810 pm2 logs 811 pm2 logs | grep catchup 812 pm2 logs 813 telnet 119.252.192.7 8087 814 ping digi2.nexg.tv 815 crontab -l 816 /root/.nvm/versions/node/v7.10.0/bin/node /etc/scripts/epgrecording/index .js 817 redis-cli 818 pm2 list 819 pm2 logs 820 vim /etc/hosts 821 redis-cli monitor 822 telnet localhost 6379 823 redis-cli monitor 824 redis-cli monitor | grep "programme_schedule" 825 redis-cli monitor 826 redis-cli monitor | grpe "more" 827 redis-cli monitor | grep "more" 828 pn2 logs 829 pm2 logs 830 top 831 pm2 logs 832 redis-cli monitor 833 pm2 logs 834 top 835 iotop 836 yum install iotop 837 iotop 838 iostat 839 pm2 logs 840 redis-cli monitor 841 vim /root/.ssh/authorized_keys 862 route add -net 172.29.2.0/23 gw 172.31.22.1 863 route -n 864 exit 865 pm2 logs netstat -anp | grep 172.31.22.55 | awk '{print $6 }' | sort | uniq -c 966 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n oarch.rpm 967 yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 968 yum install yum-utils 969 yum-config-manager --enable remi-php56 970 php -v 971 service httpd start 972 yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php -zip php-fileinfo 973 php -v 974 service httpd start 975 yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php -zip php-fileinfo 976 php -v 977 top 978 service httpd stop 979 top 980 service memcached status 981 telnet localhost 11211 982 top 983 free -m 661 nvm uninstall * 662 nvm uninstall* 663 command -v nvm 664 nvm install node 665 pm2 list |
Tuesday, 8 May 2018
remove file using script
#!/bin/bash
TIME=`date +%b-%d-%y` # This Command will add date in Backup File Name.
FILENAME=backup-$TIME.tgz # Here i define Backup file name format.
SRCDIR=/var/www/html # Location of Important Data Directory (Source of backup).
#DESDIR=/var/www/backup # Destination of backup file.
DESDIR=/home/backup # Destination of backup file.
tar -czf $DESDIR/$FILENAME $SRCDIR
#find /var/www/backup/* -mtime +5 -exec rm {} \;
find /home/backup/* -mtime +5 -exec rm {} \;
#END
TIME=`date +%b-%d-%y` # This Command will add date in Backup File Name.
FILENAME=backup-$TIME.tgz # Here i define Backup file name format.
SRCDIR=/var/www/html # Location of Important Data Directory (Source of backup).
#DESDIR=/var/www/backup # Destination of backup file.
DESDIR=/home/backup # Destination of backup file.
tar -czf $DESDIR/$FILENAME $SRCDIR
#find /var/www/backup/* -mtime +5 -exec rm {} \;
find /home/backup/* -mtime +5 -exec rm {} \;
#END
Wednesday, 2 May 2018
PHP7 Instalation
Install PHP 7.4.19
yum --enablerepo=remi-php71 php php-pear php-bcmath php-pecl-jsond-devel php-mysqlnd php-gd php-common php-intl php-cli php php-xml php-opcache php-pecl-apcu php-pecl-jsond php-pdo php-gmp php-process php-pecl-imagick php-devel php-mbstring php-soap php-mcrypt php-mcrypt php-soap phpMyAdmin roundcubemail memcached php-pecl-memcached php-pecl-memcached php-opcache php-redis redis php-redis php-zip php-pspell php-brotli
yum install php74-php php-pear php-bcmath php-pecl-jsond-devel php-mysqlnd php-gd php-common php-intl php-cli php php-xml php-opcache php-pecl-apcu php-pecl-jsond php-pdo php-gmp php-process php-pecl-imagick php-devel php-mbstring php-soap php-mcrypt php-mcrypt php-soap phpMyAdmin roundcubemail memcached php-pecl-memcached php-pecl-memcached php-opcache php-redis redis php-redis php-zip php-pspell php-brotli
Note:
After Update change on www.cof(in php-fpm) and nginx conf change php version.
PHP UpGrde
yum install php74-php-fpm
yum --enablerepo=remi-php74 install php74-php php74-php-pear php74-php-bcmath php74-php-pecl-jsond-devel php74-php-mysqlnd php74-php-gd php74-php-common php74-php-intl php74-php-cli php74-php php74-php-xml php74-php-opcache php74-php-pecl-apcu php74-php-pecl-jsond php74-php-pdo php74-php-gmp php74-php-process php74-php-pecl-imagick php74-php-devel php74-php-mbstring php74-php-soap php74-php-mcrypt php-mcrypt php-soap phpMyAdmin roundcubemail memcached php-pecl-memcached php74-php-pecl-memcached php-opcache php-redis redis php74-php-redis php74-php-zip php74-php-pspell php-brotli
install php71-php-fpm php71-php php71-php-pear php71-php-bcmath php71-php-pecl-jsond-devel php71-php-mysqlnd php71-php-gd php71-php-common php71-php-intl php71-php-cli php71-php php71-php-xml php71-php-opcache php71-php-pecl-apcu php71-php-pecl-jsond php71-php-pdo php71-php-gmp php71-php-process php71-php-pecl-imagick php71-php-devel php71-php-mbstring php71-php-soap php71-php-mcrypt php-mcrypt php-soap phpMyAdmin roundcubemail memcached php-pecl-memcached php71-php-pecl-memcached php-opcache php-redis redis php71-php-redis php71-php-zip php71-php-pspell php-brotlirm -f /usr/bin/php
ln -s /usr/bin/php71 /usr/bin/php
rm -f /usr/lib/systemd/system/php-fpm.service
ln -s /usr/lib/systemd/system/php71-php-fpm.service /usr/lib/systemd/system/php-fpm.service
systemctl daemon-reload
yum install php-mongodb php-geoip php-devel php-memcache php-memcached
yum install php74-php-mongodb php74-php-geoip php74-php-devel php74-php-memcache php74-php-memcached
yum install php-mongodb
yum install php-geoip
yum install php-devel
yum install php-memcache
yum install php-memcached
composer config -g --unset github-oauth.github.com
pecl install mongodb
vi /etc/php.ini
extension=mongodb.so
vi /etc/opt/remi/php74/php.ini
=====================================nginx install==================================
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo systemctl enable nginx
======================================================================================
PHP 7 instalation
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum update
yum-config-manager --enable remi-php71
yum -y install php php-opcache
yum -y install php-mysqlnd php-pdo
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
yum install php-devel
yum install geoip-devel
pecl install http://pecl.php.net/get/geoip-1.1.1.tgz
add extension=geoip.so to php.ini
sudo pecl install mongodb
yum install install php-memcached
yum install mod_ssl
https://askubuntu.com/questions/597372/how-do-i-modify-sys-kernel-mm-transparent-hugepage-enabled
https://www.linuxtechi.com/install-mongodb-3-2-on-centos-7and-rhel-7/
https://serverfault.com/questions/591812/how-to-set-ulimits-for-mongod
PHP 7 instalation
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum update
yum-config-manager --enable remi-php71
yum -y install php php-opcache
yum -y install php-mysqlnd php-pdo
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
yum install php-devel
yum install geoip-devel
pecl install http://pecl.php.net/get/geoip-1.1.1.tgz
add extension=geoip.so to php.ini
sudo pecl install mongodb
yum install install php-memcached
yum install mod_ssl
https://askubuntu.com/questions/597372/how-do-i-modify-sys-kernel-mm-transparent-hugepage-enabled
https://www.linuxtechi.com/install-mongodb-3-2-on-centos-7and-rhel-7/
https://serverfault.com/questions/591812/how-to-set-ulimits-for-mongod
Tuesday, 24 April 2018
mongodb create user security
I want to set up user name & password
authentication for my MongoDB instance, so that any remote access will ask for
the user name & password. I tried the tutorial from the MongoDB site and
did following:
use admin
db.addUser('theadmin', '12345');
db.auth('theadmin','12345');
After that, I exited and ran mongo again. And I
don't need password to access it. Even if I connect to the database remotely, I
am not prompted for user name & password.
UPDATE Here is the
solution I ended up using
1) At the mongo command line, set the administrator:
use admin;
db.addUser('admin','123456');
2) Shutdown the server and exit
db.shutdownServer();
exit
3) Restart mongod with --auth
$ sudo ./mongodb/bin/mongod --auth --dbpath /mnt/db/
4) Run mongo again in 2 ways:
i) run mongo first then login:
$ ./mongodb/bin/mongo localhost:27017
use admin
db.auth('admin','123456');
ii) run & login to mongo in command line.
$ ./mongodb/bin/mongo localhost:27017/admin -u admin -p 123456
The username & password will work the same
way for
mongodump and mongoexport.
You need to start
mongod with the --auth option after
setting up the user.
From the MongoDB Site:
Run the database (mongod process) with the
--auth option to enable security. You must either have
added a user to the admin db before starting the server with --auth, or add the first user from the localhost interface.
First, un-comment the line that
starts with
#auth=true in
your mongod configuration file (default path /etc/mongo.conf). This will enable authentication for mongodb.
Then, restart mongodb :
sudo service
mongod restart
This answer is for Mongo 3.2.1 Reference
Terminal 1:
$ mongod --auth
Terminal 2:
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})
if you want to add without
roles (optional):
db.createUser({user:"admin_name", pwd:"1234", roles:[]})
to check if authenticated or
not:
db.auth("admin_name", "1234")
it should give you:
1
else :
Error: Authentication failed.
0
older versions such as 2.4 would use db.addUser
I had to type
use admin before createUser otherwise it
gave an error.
This is as of v3.4.
1)
Start MongoDB without access
control.
mongod --dbpath /data/db
2)
Connect to the instance.
mongo
3)
Create the user.
use some_db
db.createUser(
{
user: "myNormalUser",
pwd: "xyz123",
roles: [ { role: "readWrite", db: "some_db" },
{ role: "read", db: "some_other_db" } ]
}
)
4)
Stop
the MongoDB instance and start it again with access control.
mongod --auth --dbpath /data/db
5)
Connect
and authenticate as the user.
use some_db
db.auth("myNormalUser", "xyz123")
db.foo.insert({x:1})
use some_other_db
db.foo.find({})
Long answer: Read this if you want to properly understand.
It's
really simple. I'll dumb the following down https://docs.mongodb.com/manual/tutorial/enable-authentication/
If
you want to learn more about what the roles actually do read more here: https://docs.mongodb.com/manual/reference/built-in-roles/
1) Start MongoDB without access
control.
mongod --dbpath /data/db
2) Connect to the instance.
mongo
3)
Create the user administrator. The following creates a user administrator in the
adminauthentication database. The user is a dbOwner over the some_db database and NOT over the admin database, this is important to remember.use admin
db.createUser(
{
user: "myDbOwner",
pwd: "abc123",
roles: [ { role: "dbOwner", db: "some_db" } ]
}
)
Or if you want to create an
admin which is admin over any database:
use admin
db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
4) Stop the MongoDB instance
and start it again with access control.
mongod --auth --dbpath /data/db
5)
Connect and authenticate as the user administrator towards the
admin authentication
database, NOT towards the some_db authentication
database. The user administrator was created in the admin authentication database, the user does not exist in the some_db authentication database.use admin
db.auth("myDbOwner", "abc123")
You
are now authenticated as a
dbOwner over the some_db database. So now if you wish to read/write/do stuff directly
towards the some_db database you can change to it.use some_db
//...do stuff like db.foo.insert({x:1})
// remember that the user administrator had dbOwner rights so the user may write/read, if you create a user with userAdmin they will not be able to read/write for example.
More
on roles: https://docs.mongodb.com/manual/reference/built-in-roles/
If
you wish to make additional users which aren't user administrators and which
are just normal users continue reading below.
6)
Create a normal user. This user will be created in the
some_db authentication database down below.use some_db
db.createUser(
{
user: "myNormalUser",
pwd: "xyz123",
roles: [ { role: "readWrite", db: "some_db" },
{ role: "read", db: "some_other_db" } ]
}
)
7) Exit the mongo shell,
re-connect, authenticate as the user.
use some_db
db.auth("myNormalUser", "xyz123")
db.foo.insert({x:1})
use some_other_db
db.foo.find({})
Edit the mongo settings file;
sudo nano /etc/mongod.conf
Add the line:
security.authorization : enabled
Restart the service
sudo service mongod restart
First run mongoDB on terminal
using
mongod
now run mongo shell use
following commands
use admin
db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
Re-start the MongoDB instance
with access control.
mongod --auth
Now authenticate yourself from
the command line using
mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin"
I read it from
db.system.users.find()
db.changeUserPassword()
db.auth('admin', 'my pass')
You'll need to switch to the database
you want the user on (not the admin db) ...
use
mydatabase
See this post for more help ... http://learnmongo.com/posts/quick-tip-mongodb-users/
use dbName
db.createUser(
{
user: "dbUser",
pwd: "dbPassword",
roles: [ "readWrite", "dbAdmin" ]
}
)
These
steps worked on me:
1. write mongod --port 27017 on cmd
2. then connect to mongo shell : mongo --port 27017
3. create the user admin : use admin db.createUser(
{ user: "myUserAdmin", pwd: "abc123", roles: [ { role:
"userAdminAnyDatabase", db: "admin" } ] } )
4. disconnect mongo shell
5. restart the mongodb : mongod --auth --port 27017
6. start mongo shell : mongo --port 27017 -u
"myUserAdmin" -p "abc123" --authenticationDatabase
"admin"
7. To authenticate after connecting, Connect the
mongo shell to the mongod: mongo --port 27017
8. switch to the authentication database : use
admin db.auth("myUserAdmin", "abc123"
//connection show in mongo db by give command
grep 2019-01-26 mongod.log | grep "end connection" | awk -F "end connection" '{print $2}' | awk '{print $2}' | sort | tail
//connection show in mongo db by give command
grep 2019-01-26 mongod.log | grep "end connection" | awk -F "end connection" '{print $2}' | awk '{print $2}' | sort | tail
2 . db.serverStatus().connections
====================================
Url: http://adminapp.nexg.tv/admin/default/login
Username: admin@nexgtv.com
Password: NexGTV_123
admin@Digivive1
Password: Digi_1234
password: Digi@Nexg123
CRM0924TTOFO4
URL - adminapp.nexg.tv/admin/default/login
Admin User Name : admin@nexgtv.com
Password : Digi@Nexg123
PK482
http://dev-app.nexg.tv/
172.31.22.238
http://dev-app-digivive.nexg.tv/admin/default/login
admin@nexgtv.com
Digi@Nexg123
vodafone : 9643467350
vodafone 8587916376
alok no 7290947826
================================================
"hosts" : [
"Appinv-db:27017(172.31.22.235)",
"Appinv-db3:27017(172.31.22.160)",
"INWAP-06:27017(172.31.22.55)",
"Appinv-db2:27017(172.31.22.236)"
],
rs.printSlaveReplicationInfo()
http://dev-app-digivive.nexg.tv/admin/channel/index
User Name :admin@nexgtv.com
Password : Digi@Nexg123
====================================================
Private IP(172.31.22.91)
http://dev-app-digivive.nexg.tv/(172.31.22.91)
Username : admin@nexgtv.com
Password : Digi_1234
find / -type f -name "*.php" -exec grep -il tapan {} \;
=========================================
mongodb
db folder create 1st
mongod --storageEngine=mmapv1 --dbpath [your-path]
mongod --storageEngine=mmapv1 --dbpath C:/data/db
//database backup and restore command
mongodump --db wowza --out /root/mong_nexgtv_9aug16
mongodump --db nexgtv_16 --out /root/mong_nexgtv_9aug16
mongorestore --db nexgtv_16 /home/mongodump/mong_nexgtv_9aug16/nexgtv_16
mongoimport --db dbName --collection collectionName --file fileName.json --jsonArray
=============================================
//export file in mongodb
mongoexport -d mydb -c mycollection -o mybackup.json
connected to: 127.0.0.1
exported 9438 records
mongoexport -d nexgtv_16 -c ADMIN -o /home/mybackup.json
//Import file in push file in mongodb
mongoimport -d mydb -c mycollection --file mybackup.json
connected to: 127.0.0.1
Sat Jan 16 12:06:10 imported 19878 objects
mongoimport -d nexgtv_16 -c VOUCHERS --file /var/www/vouchecollive/VOUCHERS_28sep_16_backup.json
mongoimport -d nexgtv_16 -c VOUCHER_CODES --file /var/www/vouchecollive/VOUCHER_CODES_28sep_16backup.json
===================================
vendor/yiisoft/yii2-mongodb
==================================
521F4D84-F6BD-4445-821E-06A6DE28F632_DEN
9910058197(VIDDTH Registred Mobile number)
rm -rf DUMMY*
rm -rf Launch_User*
rm -rf USER_HISTORY*
rm -rf NOTIFICATION_HISTORY_*
bulksms@infotelconnect.com
mongorestore -d nexgtv_bcup -c SESSION /var/www/nexgtv-2017-01-12-0000/nexgtv_16/SEASON.bson
tar -xvzf /var/www/nexgtv-2017-01-12-0000.tgz
mongorestore -d db_name -c collection_name path/file.bson
============================================================
mongodump --db=<old_db_name> --collection=<collection_name> --out=data/
mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson
netstat -anp | awk '{print $6}' | sort | uniq -c
=====================================================
Multiple coloum update using mongo query
db.ASSETS.update({categories:{$in:['CTG513','CTG514']}},{$set: {content_id:"5682cd15cc95b319a65da89b"}},{multi:true})
860848034403882
9722782295
863819036347945
832 pm2 start scheduleworker.js -n cathcup
833 pm2 stop cathcup
834 ls -ltr
835 vim config.js
836 yum install redis
785 pm2 start app.js -n digiapis -i 0
786 pm2 save
787 pm2 list
db.getReplicationInfo()
rs.printSlaveReplicationInfo()
rs.printSlaveReplicationInfo()
db.currentOp()
db.stats();
db.serverStatus().connections
mongostat
grep 2019-01-26 mongod.log | grep "end connection" | awk -F "end connection" '{print $2}' | awk '{print $2}' | sort | tail
2 . db.serverStatus().connections
7055394939
==========================================
mongorestore --db wowza --drop /var/www/analyticsdump/home/wowza_analytics_bcup/wowza_analytics/wowza_analytics/wowza_analytics-2018-07-23-1634/wowza/
===================================
http://dev-nexgtv.nexg.tv/#/
Subscribe to:
Posts (Atom)