Linux

Tips

Add route in windows
route ADD 192.168.30.0 MASK 255.255.255.0 10.255.10.4
SCP copy from local to remote
scp -i ~/.ssh/user_rsa -r folder user@svifscapl003.prd.srv.cirb.lan:/tmp
SCP copy from remote to remote using your local computer
ssh-add ~/.ssh/alhazen_rsa
# Give alhazen the permission to write on targetfqdn:/srv/tmp
ssh -A -i  ~/.ssh/alhazen_rsa alhazen@sourcefqdn \
"scp -o StrictHostKeyChecking=No /srv/data/pgserver.dump alhazen@targetfqdn:/srv/tmp"
ssh/config to force ssh with pwd on a specific host
Host 192.168.xx.xx
  PreferredAuthentications password
DNS
$ nslookup.exe stash.cirb.lan 192.168.34.2xx (1)
Non-authoritative answer:
Server:  svidscapw000.ad.cirb.lan
Address:  192.168.34.2xx

Name:    stash.cirb.lan
Address:  192.168.34.xx
1 DNS to lookup + DNS server
List swap usage
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | grep kB | sort -k2 -n
Script control
#!/bin/bash -xe
set -euo pipefail (1)
1 exits immediately when a command fails (e) even within a pipe (o pipefail), treat unset variables as an error (u)
Convert html to pdf
pandoc --latex-engine=xelatex -o blog.pdf http://blog.jakubarnold.cz/2014/07/22/building-monad-transformers-part-1.html

LVM

  • change disk size on the VCloud

  • create a new partition with fdisk (ie: sdb1) so we don’t change anything on the existing partition table

  • add this new partition as a new physical volume: pvcreate /dev/sdb1

  • vgextend system_vg /dev/sdb1

  • lvextend -L+12G /dev/system_vg/data

  • xfs_growfs /dev/system_vg/data

or by adding a new disk using puppet :

  • add a new disk on the VCloud

  • after a few delay, VCloud will automatically create a new partition for instance '/dev/sdd'

  • add this new partition as a new physical volume: pvcreate /dev/sdd. You bb can see it with pvs

  • vgextend vg_rhel /dev/sdd (the name to 'vg_rhel' is fixed for our new RHEL 7 template)

  • puppet agent -t will now create a new lv nix. You can see it with lvs

at the CIRB the easier is:

  • to ask for a machine with 40G (second disk usually /dev/sdb)

  • The machine will be received with a full vg_rhel of 40G. Go to the vcloud console and extend the second disk to 60G

  • The machine now has a /dev/sdb disk with 60G. Extends the pv using pvresize -v /dev/sdb. And check with vgdisplay or pvs.

Concepts

Glossary

The iSCSI (Internet Small Computer System Interface)

is a TCP / IP-based protocol used to establish and manage interconnections between IP storage devices, hosts and clients, and to create storage area networks (SANs )

Application layer

HTTP, SNMP, AMQP, XMPP, IRC, DHCP, WebDAV, SSH, FTP, SIP, Telnet

Transport layer

TCP, UDP (SCTP)

Protocol buffers

language-neutral, platform-neutral extensible mechanism for serializing structured data.

Push (SSE) vs Pull (REQ/REP)

Server Send Events

Logs

journalctl -r

show logs in reverse order

journalctl -b

show logs since last boot

journalctl -k -p err

show error kernel logs

journalctl -p warning

show logs with warning priority

journalctl --since=2016-08-01

show logs since

journalctl --until=2016-08-03

show logs until

journalctl --until=today

show logs until midnight today

journalctl --since=yesterday

show logs since yesterday midnight

journalctl --since=-2week

show logs for last 2 weeks

journalctl -u <unit-name>

show logs of certain unit

journalctl /dev/sda

show kernel message of device

journalctl -o json

show logs in json format