Thursday, 17 September 2015

How to configure mongodb with chef

https://github.com/netinlet/chef-mongodb_replicaset.git

Note - No Brekshelf

Note EBS JSON

{
 "mongodb" : {
   "replicaset_name": "mongo-rs",
     "cluster_name": "mongo-rs",
     "auto_configure": {
       "replicaset": true
     }
 }
}

WITH EBS

{
"mongodb" : {
 "replicaset_name": "mongo-rs",
   "cluster_name": "mongo-rs",
   "auto_configure": {
     "replicaset": true
   },
 "dbpath":"/data/lib/mongodb",
 "logpath":"/data/log/mongodb"
}
}

Recipes

Setup mongodb::10gen_repo mongodb::default
auto_configure             mongodb::replicaset


Note - After you done with Installation.

Login into EC2

Master -

$ - mongo
> rs.intiate()
> rs.add("ip-10-123-25-111.ap-southeast-1.compute.internal:27017")

How to scp EC2

Machine to EC2
scp -i myAmazonKey.pem FILE ubuntu@mec2-50-17-13-12.compute-1.amazonaws.com:~/.

EC2 to local
scp -i ec2key.pem username@ec2ip:/path/to/file .


TAR File

tar cvzf nameoffiletocreate.tar.gz locationthatyouwant

example - tar cvzf harish.tar.gz /ubuntu/harish/Desktop/

Unrar TAR File

tar -xvzf harish.tar.gz



Single bucket policy

For Multiple Bucket


{
       "Version": "2012-10-17",
   "Statement": [
       {
           "Effect": "Allow",
           "Action": "s3:*",
           "Resource": [  "arn:aws:s3:::harish/*",
               "arn:aws:s3:::harish1/*"  ]
       }
                           ]
}


For Single bucket


{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::harish/*"
}
]
}