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")
Thursday, 17 September 2015
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/*"
}
]
}
Tuesday, 28 July 2015
Find server Machine IP with NGINX LUA
Step 1 install
wget http://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz
tar xvzf ngx_openresty-1.7.10.2.tar.gz
cd ngx_openresty-1.7.10.2/
sudo apt-get update
sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential
./configure --with-luajit
make
sudo make install
mkdir ~/work
cd ~/work/
mkdir conf/ logs/
vim conf/nginx.conf
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
nginx -p `pwd`/ -c conf/nginx.conf
curl localhost:8080
Step 2
Note - use step 2 only if you want to use content by lua and skip step 3,4
## content by lua
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}
Step 3
Note - use this if you want to use content by lua file in this skip step 2
## content by lua file
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua_file '/home/mr/cache.lua';
}
}
}
Step 4
Note - lua file that you want to pass from nginx
## content by lua file
vim /home/mr/cache.lua
ngx.print(ngx.var.remote_addr)
Step 5
Note - if any isssue to start the nginx
Trobleshoot -
ps ax| grep nginx
sudo kill -9 PID
Step 6
Note - how to start nginx and open on browser IP:8080
Start ->
nginx -p `pwd`/ -c conf/nginx.conf
curl localhost:8080
wget http://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz
tar xvzf ngx_openresty-1.7.10.2.tar.gz
cd ngx_openresty-1.7.10.2/
sudo apt-get update
sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential
./configure --with-luajit
make
sudo make install
mkdir ~/work
cd ~/work/
mkdir conf/ logs/
vim conf/nginx.conf
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
nginx -p `pwd`/ -c conf/nginx.conf
curl localhost:8080
Step 2
Note - use step 2 only if you want to use content by lua and skip step 3,4
## content by lua
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}
Step 3
Note - use this if you want to use content by lua file in this skip step 2
## content by lua file
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua_file '/home/mr/cache.lua';
}
}
}
Step 4
Note - lua file that you want to pass from nginx
## content by lua file
vim /home/mr/cache.lua
ngx.print(ngx.var.remote_addr)
Step 5
Note - if any isssue to start the nginx
Trobleshoot -
ps ax| grep nginx
sudo kill -9 PID
Step 6
Note - how to start nginx and open on browser IP:8080
Start ->
nginx -p `pwd`/ -c conf/nginx.conf
curl localhost:8080
Monday, 15 June 2015
How to create FTP for aws without directory Listing
Step 1
1 - apt-get install vsftpd
2 - vim /etc/vsftpd.conf
3 - changes
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES ( First One )
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
pasv_enable=YES
port_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=0.0.0.0
Note - 0.0.0.0 will be your be your public IP
Step 2
Add Port in your Security Group
tcp 20-21
tcp 1024-1048
Step 3 echo 'allow_writeable_chroot=YES' >> /etc/vsftpd.conf
Done
Wednesday, 10 June 2015
How to setup mongodb replSet
Master IP - 172.31.9.122
Replset IP - 172-31-17-152
Step 1 - Install mongoDB
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# sudo apt-get update
# sudo apt-get install -y mongodb-org
Step 2 - vim /etc/mongod.conf
Change
Bind Ip - 172-31-9-122 (your IP)
Replsetname - harish (Your Replset Name)
Note - Be Carefull and change according.
Step 3 - Login into mongo
mongo --host 172.31.9.122
>
rs.initiate(
{_id: "harish",
members: [
{
_id: 1,
host: "ip-172-31-9-122.ap-southeast-1.compute.internal",
arbiterOnly: false,
buildIndexes: true,
priority: 1
}
]
}
)
Step 4 - Install MongoDB with step 1
Step 5 - vim /etc/mongod.conf
Change
Bind Ip - 172-31-17-152 (your IP)
Replsetname - harish (Your Replset Name)
Step 6 - Add you replset
Login to you master mongo
mongo --host 172.31.9.122
>
rs.add('ip-172-31-17-152.ap-southeast-1.compute.internal:27017')
Note -
service mongod start
service mongod stop
service mongod status
If not running then go /var/lib/mongod/mongo.lock and delete mongo.lock file then start you mongod
Replset IP - 172-31-17-152
Step 1 - Install mongoDB
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# sudo apt-get update
# sudo apt-get install -y mongodb-org
Step 2 - vim /etc/mongod.conf
Change
Bind Ip - 172-31-9-122 (your IP)
Replsetname - harish (Your Replset Name)
Note - Be Carefull and change according.
Step 3 - Login into mongo
mongo --host 172.31.9.122
>
rs.initiate(
{_id: "harish",
members: [
{
_id: 1,
host: "ip-172-31-9-122.ap-southeast-1.compute.internal",
arbiterOnly: false,
buildIndexes: true,
priority: 1
}
]
}
)
Step 4 - Install MongoDB with step 1
Step 5 - vim /etc/mongod.conf
Change
Bind Ip - 172-31-17-152 (your IP)
Replsetname - harish (Your Replset Name)
Step 6 - Add you replset
Login to you master mongo
mongo --host 172.31.9.122
>
rs.add('ip-172-31-17-152.ap-southeast-1.compute.internal:27017')
Note -
service mongod start
service mongod stop
service mongod status
If not running then go /var/lib/mongod/mongo.lock and delete mongo.lock file then start you mongod
Tuesday, 19 May 2015
How to attach EBS volume available for use on Linux
Step 1
[ec2-user ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdf 202:80 0 100G 0 disk
xvda1 202:1 0 8G 0 disk /
Step 2
mkdir /data
Step 3
mount /dev/xvda1 /data
Wednesday, 6 May 2015
Hwo to install Text Browser
Install Lynx on Debian/Ubuntu based Linux systems.
# apt-get install lynx
# apt-get install links
Install Lynx on Red Hat based Linux systems.
# yum -y install lynx
# yum -y install links
# apt-get install lynx
# apt-get install links
Install Lynx on Red Hat based Linux systems.
# yum -y install lynx
# yum -y install links
Speed testing your website with Siege Automatic
Installation via Homebrew
First, install homebrew using the instructions from https://github.com/mxcl/homebrew/wiki/installation. Once installed you can simply install Siege in one command:$ brew install siege
|
Using Siege
Now that Siege is installed we can begin speed testing your website. First thing to do is to create the siege config file in your home directory.~ $ siege.config
New configuration template added to /home/andrew/.siegerc
Run siege -C to view the current settings in that file
~ $ siege -c10 -d10 -r1 -v http://www.harish.com/
** SIEGE 2.72
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.13 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
done.
Transactions: 10 hits
Availability: 100.00 %
Elapsed time: 8.12 secs
Data transferred: 0.04 MB
Response time: 0.11 secs
Transaction rate: 1.23 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.14
Successful transactions: 10
Failed transactions: 0
Longest transaction: 0.13
Shortest transaction: 0.11
Let’s break this down a little. First we entered the siege command with a number of parameters:
-
-c10 is the number of concurrent users we want to simulate.
-
-r1 is the number of repetitions, in this case, 1.
-
-d10 is the delay between each user request (each siege simulated
users sleeps for a random interval in seconds between 0 and 10).
Speed testing your website with Siege Manual
sudo apt-get install siege
$ curl http://www.joedog.org/pub/siege/siege-latest.tar.gz -o siege-latest.tar.gz
$ tar xvfz siege-latest.tar.gz
$ cd siege-2.72
$ ./configure
$ make
$ make install
This will install Seige to /usr/local/bin/siege.
~ $ siege -c10 -d10 -r1 -v http://www.harish.com/
** SIEGE 2.72
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.13 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
HTTP/1.1 200 0.12 secs: 4123 bytes ==> /
HTTP/1.1 200 0.11 secs: 4123 bytes ==> /
done.
Transactions: 10 hits
Availability: 100.00 %
Elapsed time: 8.12 secs
Data transferred: 0.04 MB
Response time: 0.11 secs
Transaction rate: 1.23 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.14
Successful transactions: 10
Failed transactions: 0
Longest transaction: 0.13
Shortest transaction: 0.11
|
Let’s break this down a little. First we entered the siege command with a number of parameters:
-
-c10 is the number of concurrent users we want to simulate.
-
-r1 is the number of repetitions, in this case, 1.
-
-d10 is the delay between each user request (each siege simulated
users sleeps for a random interval in seconds between 0 and 10).
-
-v is to show the output of each request.
Thursday, 30 April 2015
Bugzilla Error
comment line 451 to 471 and paste with this
tr_quicksearch.cgi
my $product = Bugzilla::Extension::Testopia::Product->new($product_id);
my @comps;
foreach my $c (@{$product->components}) {
if (!$cgi->param('query') || $c->name =~ m/$q/i) {
push @comps, {
'id' => $c->id,
'name' => $c->name,
'qa_contact' => $c->default_qa_contact ? $c->default_qa_contact->login : '',
'product' => $c->product->name,
};
}
}
221
tr_process_case.cgi use bracket
foreach my $field (qw(action effect) ) {
tr_quicksearch.cgi
my $product = Bugzilla::Extension::Testopia::Product->new($product_id);
my @comps;
foreach my $c (@{$product->components}) {
if (!$cgi->param('query') || $c->name =~ m/$q/i) {
push @comps, {
'id' => $c->id,
'name' => $c->name,
'qa_contact' => $c->default_qa_contact ? $c->default_qa_contact->login : '',
'product' => $c->product->name,
};
}
}
221
tr_process_case.cgi use bracket
foreach my $field (qw(action effect) ) {
Thursday, 9 April 2015
How Install wamp Server and IIS
WAMPSERVER
Install the wampserver and File if any issue to start the wamp services.
IIS
Open the control Pannel -> Add Remove -> add Fetures.
Check the IIS
How to Create Own Drop Box
How to Create OWNCLOUD
Step-1 Install Wampserver
Step-2 download the Own cloud File from the under Link
Step-3 Now Unzip and copy the Own Cloud Folder under www of wamp
Step-4 Now give username and password of you wish
DONE :-)
Wednesday, 8 April 2015
How to Delete Default Profile In Outlook
Run -> regedit
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles\
Outlook 2010
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Windows Messaging SubSystem\Profile\profile-name
Note - delete the profile or delete the whole
under Profile if you want Default Setting
Subscribe to:
Posts (Atom)