pm2 start app.js --log-date-format 'DD-MM HH:mm:ss.SSS'
nJoy π
pm2 start app.js --log-date-format 'DD-MM HH:mm:ss.SSS'
nJoy π
If you need to automate firewall settings for AWS by service this is a real time source of info you can pro grammatically use.
https://ip-ranges.amazonaws.com/ip-ranges.json
nJoy π
With `openssl`, it’s not too hard.
(Note: If you’re on OSX, you should install the latest versions of OpenSSL and OpenSSH with Homebrew.)
First, let’s start with our plaintext file:
echo "Yo test!!" > clear.txt
Before we can encrypt the text file with our public key, we must export our public key into a PEM format suitable for OpenSSL.
openssl rsa -in ~/.ssh/id_rsa -pubout > ~/.ssh/id_rsa.pub.pem cat ~/.ssh/id_rsa.pub.pem
It should look something like this:
-----BEGIN PUBLIC KEY----- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-----END PUBLIC KEY-----
cat plain.txt | openssl rsautl -encrypt -pubin -inkey ~/.ssh/id_rsa.pub.pem > encrypted.txt
The important command in the pipeline is `openssl`. The first argument passed to `openssl` is the OpenSSL command you are running. It has a wide variety of commands covering a wide range of cryptographic functionality. For our purposes, we’re doing public/private RSA encryption, so we’re using the RSA Utility, or `rsautl`, command. Next, the `-encrypt` key indicates we are encrypting from plaintext to cipher text, and finally the `-pubin` flag indicates we are loading a public key from `-inkey [public key file]`.
Print the contents of the encrypted with `cat encrypted.txt`.
You should see non readable stuff.
cat encrypted.txt | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa
“Yo test!!”
Voila`! We’re back to clear text.
So I need to get information about a particular set of machines in the cloud (AWS).
EC2_INSTANCE_ID="`wget -q -O - http://instance-data/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`" test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id' EC2_AVAIL_ZONE="`wget -q -O - http://instance-data/latest/meta-data/placement/availability-zone || die \"wget availability-zone has failed: $?\"`" test -n "$EC2_AVAIL_ZONE" || die 'cannot obtain availability-zone' EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
nJoy π
This is the “expected” behavior. Let me explain it, with a cluster of 3 nodes and 1 replica.
So you have started with 1 node, so in this case you have only “active documents” (no replica)
Then you add another node, and do a rebalance. Once it is done you have 50% of the active data on each node, and 50% of the replica on each node.
Let’s add a new node again, just to have a more “realistic” cluster of 3 nodes. So the node is added and cluster is rebalanced. This means now you have, as you can guess 33.33% on each node (Active and Replica)
So what you have notice is that the Rebalance is an expensive operation, since the cluster has to move data between all the nodes. (moving active and replicas).
You have a now a well balanced 3 nodes cluster.
Now you stop one node, or one node crashes… this means that some of the data are not accessible (they are still here not available, you do not lose anything).
Here you have 2 options:
– if you restart the server, nothing to do the cluster is back online entirely. (3 nodes cluster well balances)
you do a failover on the node that is off. Let’s explain this in detail.
Failover:
So what is happening here: Couchbase will do that as fast as possible to be sure all the data are available(read and write). So the only thing that is happening here is: promote the replicas to active (for the keys that were active on the node that is off now)
So what is the status now?
– all the data are accessible in read/write for the application on 2 nodes, so you have 50% of the active data on each node.
– BUT you do not have all the replicas since:
– the replicas that are on the node that is off are “not present”
– the replicas that have been promoted are not present anymore
This is why you see the message “Fail Over Warning: Rebalance required, some data is not currently replicated!” in your console.
Does it make sense?
So to be able to get back in a status that is “balanced” you need to do a rebalance.
Note: when you failover of node, this node is removed from the cluster, and to add it back you need to add it, and rebalanced. (the data that are on this server are just “ignored”)
Hope this clarify the message.
Some pointers about this:
– http://docs.couchbase.com/couchbase-manual-2.2/#couchbase-admin-tasks-failover5
– http://docs.couchbase.com/couchbase-manual-2.2/#couchbase-admin-tasks-failover-addback4
root ~ # hostnamectl set-hostname --static "YOUR-HOSTNAME-HERE"
nJoy π
yum install gcc-c++ make openssl-devel
wget http://nodejs.org/dist/v0.8.15/node-v0.8.15.tar.gz tar zxvf node-v0.8.15.tar.gz cd node-v0.8.15 ./configure make make install
yum install git git clone git://github.com/joyent/node.git cd node ./configure make make install
nJoy π
This is quite a common issue with X11 upgraded on a Centos Minimal.
quick fix ( not perfect but gets the system through the hump :
dbus-uuidgen > /var/lib/dbus/machine-id
This should fix the issue.
nJoy π
This is the basic structure for a node.js package file
{
"name": "Express-Basic",
"description": "Demonstrating Express",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x"
}
}
nJoy π
Assume you do not have curl/telnet/netcat (or nc does not support -z as in later versions ?? why did they remove it ?? ) the following will work on any recent Bash version.
(echo > /dev/tcp/skinner/22) >/dev/null 2>&1 && echo "Port is open" || echo "Port is closed"
nJoy π