Ambari stack for easily installing and managing MongoDB on HDP cluster,clusters include shard,replica,config,mongos. http://www.bigdatalab.top/archives/180
Follow given step to install and manage Mongo DB using Ambari.
ssh root@ambari.machine
on HDP 2.4
cd /var/lib/ambari-server/resources/stacks/HDP/2.4/services
git clone https://github.com/geniuszhe/ambari-mongodb-cluster.git
sudo service ambari-server restart
On bottom left -> Actions -> Add service -> check MongoDB -> Next -> Next -> Next -> Deploy
maybe there is something waring just restart the wrong service
config param node_group.new add hosts is new group.split by ; restart mongodb
maybe you just add one host
sometimes add host can not run successfully,replica set can not initial .
See http://serverfault.com/questions/424465/how-to-reset-mongodb-replica-set-settings
export SERVICE=MONGODB
export PASSWORD=admin
export AMBARI_HOST="your_ambari_hostname"
export CLUSTER="your_ambari_cluster_name"
#get service status
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
#start service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
#stop service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
To remove the MongoDB:
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X DELETE http://replace_with_your_ambari_hostname.com:8080/api/v1/clusters/ambari_cluster_name/services/MONGODB
rm -rf /var/lib/ambari-server/resources/stacks/HDP/2.4/services/mongo-ambari
service ambari restart