Controlling Machines Remotely via IPMI

IPMI

Each server has a little ARM machine glued on the side with a dedicated ethernet port. Using standard protocols, as well as manufacturer extensions, we can do all sorts of useful things to the server remotely. Each machine’s IPMI card has an IP address that resolves from host “rcXXipmi”. Some of these include:

  • Powering on/off, resetting, warm reboots, software shutdowns, etc.
  • Accessing a serial-over-lan version of the console (can use this to configure BIOS parameters, as well as get a Linux console)
  • Setting PXE boot for the next boot cycle (allows easy network re-installs)
  • Listing sensor status (temperatures, voltages, etc)
  • Listing error log (ECC errors, even SMART disk errors)
  • Getting a remote KVM console (keyboard, video, mouse)

There are two main utilities you’ll want to use:

ipmitool

ipmitool is linux app that speaks the ipmi protocol to local and remote servers. Here are some example commands to get you started (read the extensive man page for more info):

  • Get a serial-over-lan console on rcXX: ipmitool -I lanplus -H rcXXipmi -U ADMIN -a sol activate
  • Get the power status: ipmitool -I lanplus -H rcXXipmi -U ADMIN chassis status
  • Reboot a machine: ipmitool -I lanplus -H rcXXipmi -U ADMIN power reset
  • Force PXE boot on the next boot only: ipmitool -I lanplus -H rcXXipmi -U ADMIN chassis bootdev pxe
    (This will cause the machine to reinstall all its software on the next boot)
  • Reboot the IPMI card: ipmitool -I lanplus -H rcXXipmi -U ADMIN mc reset cold
  • Get sensor output: ipmitool -I lanplus -H rcXXipmi -U ADMIN sdr list
  • Get the error log: ipmitool -I lanplus -H rcXXipmi -U ADMIN sel elist

 

For more information : https://ramcloud.atlassian.net/wiki/display/RAM/Controlling+Machines+Remotely+via+IPMI

 

 

 

 

 

Controlling Machines Remotely via IPMI

Quick How-to to set up Swarm cluster

1.Define a file hosts with the entries below, where : 192.168.1.3 is the IP address of the node manager, and 192.168.1.5 and 192.168.1.6 are simple nodes.

# Hosts
node1 ansible_host=192.168.1.3
node2 ansible_host=192.168.1.5
node3 ansible_host=192.168.1.6

[swarm]
node1
node2
node3

2.On node manager (192.168.1.103) run :

$ docker swarm init 3. Run the docker swarm join command on the rest of nodes, using ansible

$ ansible swarm:’!192.168.1.103′ -m shell -a ‘docker swarm join –token SWMTKN-1-32c9u5o0y7gbp3zg8wlvkacbcz0jcwnfgzyhitn5xk8v3gi7s5-2pyej0kduwv6kmx7ynjjvxnhl 192.168.1.103:2377′

The token WMTKN-1-32c9u5o0y7gbp3zg8wlvkacbcz0jcwnfgzyhitn5xk8v3gi7s5-2pyej0kduwv6kmx7ynjjvxnhl should depends on the return of the command : dockers swarm init.

4.Open 2377 TCP port on your firewall if you have one activated.

$ ufw allow 2377/tcp

5.Create the service :

$ docker service create –name hello-world –replicas 3 -p 80:80 dockercloud/hello-world

Quick How-to to set up Swarm cluster

Configuring FCoE in Linux RHEL and HP FlexFabric

– First step is to identify Ethernet NIC’s and CNA that will pass FCoE traffic and thi is done by collecting information about MAC adresses.
– Installation of both of packages : fcoe-utils and lldpad
yum install fcoe-utils lldpad
– Load the driver bnx2fc
modprobe bnx2fc
– Renaming /etc/fcoe/cfg-ethx file to the name of the CNA, in our case it is eth2 :
cp /etc/fcoe/cfg-ethx /etc/fcoe/cfg-eth2
cat > /etc/fcoe/cfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth2<EOF
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=NO
MTU=9000
EOF
The MTU is set to 9000 because FC payload is 2,112 bytes jumbo frames must be turned on to
avoid unnecessary IP fragmentation
– Run ifup to bring FCoE interface up
ifup eth2
– Run fcoeadm -i to check all created FCoE interfaces and status.
– Run cat /proc/scsi/scsi to see the luns

Configuring FCoE in Linux RHEL and HP FlexFabric

Install bower on Ubuntu 14.04

I need to install bower to manage my js library for such use I need to install it using npm the nodejs package manager.
I you need nodejs on ubuntu 14.04 don’t install it using apt-get, the ubuntu packages are bad.
You may install the official package for ubuntu from nodejs website.

curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install --yes nodejs

bower is a shell tool, you have to install it globally so I run:
npm install -g bower

Install bower on Ubuntu 14.04

Quick setup : Free tier ec2 amazon instance

I create a free tier ec2 instance in amazon, I reserve an Elastic IP and assign it to my instance.
I install nginx and When I need to access nginx from internet, for that I went to my domain registrar godaddy I create a CNAME that point to this Elastic IP.
Finally I create a security group, I open stream to HTTP port, and my ec2 instance is became ready to use and to share http content.

Quick setup : Free tier ec2 amazon instance

Install and configure MongoDB in Ubuntu

We will install the most recent version of MongoDB from the 10gen repo. This requires us to first register the public key for the 10gen MongoDB apt repository, add the repository, and continue with the MongoDB installation.

Configure MongoDB
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | sudo tee -a /etc/apt/sources.list.d/10gen.list
sudo apt-get -y update
sudo apt-get -y install mongodb-10gen vim curl

Create the database and database user
We need to create our database (proddb) and database user(admin).All commands denoted with ‘>’ are executed inside of MongoDB.

sudo mongo
>use proddb
>db.addUser({user: "admin",pwd: "bacon&eggs",roles: ["dbAdmin"],})
>exit

Modify MongoDB settings
We need to modify our MongoDB configuration to set the bind address to ‘0.0.0.0’ and port to ‘27017’. By default these values should be correct, but we want to ensure these settings are configured explicitly.

sudo vim /etc/mongodb.conf

Ensure the following is set correctly (note this is only a portion of the configuration file):

# mongodb.conf

# Where to store the data.

# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb

#where to log
logpath=/var/log/mongodb/mongodb.log

logappend=true

port = 27017
bind_ip = 0.0.0.0

Restart the database
Now just restart the database for the changes to take effect.

sudo service mongodb restart

Install and configure MongoDB in Ubuntu

Fork from github and add change to your own repository

When playing with vagrant, I set up a haproxy keepalived apache stack on ubuntu precise.
For that I forked this repository vagrant-haproxy-demo from github (https://github.com/justintime/vagrant-haproxy-demo.git) that run a haproxy standalone instance and I append my change to it to support keepalived.

First of all, I create the repository vagrant-haproxy-keepalived.
and I set remote origin to the repository created.
I create a new branch named development, I modify code and I do a commit.

Finally I checkout to master and rebase the branch development.


git remote set-url origin https://github.com/mezgani/vagrant-haproxy-keepalived.git
git checkout -b development
git add .
git commit -a
git checkout master
git rebase development
git push origin master

My code is here https://github.com/mezgani/vagrant-haproxy-keepalived.git, you can browse code.

Fork from github and add change to your own repository