Friday, 4 October 2013

Simple unbound upstart script

  1. put below in /var/tmp/unbound.conf
  2. pkill unbound
  3. lsof -nP -i :53
  4. pgrep unbound
  5. cp -v /var/tmp/unbound.conf /etc/init/
  6. start unbound
  7. status unbound
  8. status unbound
  9. start unbound
start on runlevel [3]
expect fork
exec unbound

Thursday, 3 October 2013

Sanity of growing a stripped LVM volume

Quote:

However, with LVM you can easily grow a logical volume. But, you cannot use stripe mapping to add a drive to an existing striped logical volume because you can’t interleave the existing stripes with the new stripes. This link explains it fairly concisely.

    “In LVM 2, striped LVs can be extended by concatenating another set of devices onto the end of the first set. So you can get into a situation where your LV is a 2 stripe set concatenated with a linear set concatenated with a 4 stripe set.”

Taken: Pick Your Pleasure: RAID-0 mdadm Striping or LVM Striping?

Tuesday, 1 October 2013

Create isolated bucket on S3

  1. setup
    1. create IAM group
      1. add simple, custom policy below
      2.  do not add any other policies to group
    1. create IAM user and put in above IAM group
      1. create and download key and secret for user
    2. create bucket "mybucket01" in S3
      1. you don't have to touch perms of bucket itself
  2. client
    1. install s3fox addon for Firefox from www.s3fox.net
      1. older versions FAIL! get it only at www.s3fox.net
    2. open s3fox addon
      1. Firefox -> Tools -> S3 Organizer
    3. add only one user to "Manage Accounts" using user key and secret
    4. in right-hand window of s3fox add "/mybucket01" NOT "/"
      1. "/" will give you "Access Denied"
        1. because user does not have perms to list root buckets, only itself
{
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "arn:aws:s3:::mybucket01"
        },
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::mybucket01",
                "arn:aws:s3:::mybucket01/*"
            ]
        }
    ]
}   

Snapshot AWS instance store as AMI

  1. install api-tools
  2. install ami-tools
  3. generate key / cert
  4. create IAM user 
  5. upload cert
  6. java install / export JAVA_HOME
  7. export key and secret
  8. ec2-bundle-vol 
    1. --user  <AWS acct #> 
    2. --privatekey /myhome/my-key.pem
    3. --cert /myhome/my-cert.pem
    4. --arch x86_64
    5. --destination /var/tmp
    6. --exclude
      1. /backup,
      2. /mnt,
      3. /swapfile
  9. ec2-upload-bundle
    1. --manifest /var/tmp/image.manifest.xml
    2. --bucket mybucket/hostname
    3. --access-key <AWS Key>
    4. --secret-key <AWS Secret>
    5. --location EU
  10. ec2-register
    1. --region eu-west-1
    2. --name "myaminame"
    3. --description "Backing up hostname"
    4. mybucket/hostname/image.manifest.xml
Taken:
  1. http://www.dowdandassociates.com/content/howto-create-an-instance-store-backed-amazon-ec2-ami/
  2. http://www.dowdandassociates.com/content/howto-install-aws-cli-amazon-elastic-compute-cloud-ec2-ami-tools/
  3. http://www.dowdandassociates.com/content/howto-install-aws-cli-amazon-elastic-compute-cloud-ec2-api-tools/
NOTE: the above link's content has typos in very essential parts, proof all steps

Monday, 30 September 2013

Monitoring Zookeeper

Option 1
  1. yum -y install git
  2. cd
  3. mkdir bin
  4. mkdir tools
  5. cd tools
  6. git clone https://github.com/phunt/zktop.git
  7. nice updatedb
  8. locate zoo.cfg
    1. jot this path down for step below
    2. let's call it "mypathtozoocfg"
    3. the name of your zk conf may vary, adjust if so
  9. cd
  10. cd bin
  11. ln -s /root/tools/zktop/zktop.py .
    1. make sure you put the '.' on the end of that command
  12. /root/bin/zktop.py --config /<mypathtozoocfg>/zoo.cfg
Option 2, by hand
  1. echo srvr | nc localhost 2181
  2. echo stat | nc localhost 2181
  3. echo cons | nc localhost 2181
  4. etc.
  5. Try: watch -d "echo stat | nc localhost 2181" 
    1. on all zk nodes 
    2. in separate terms
Break-out
  1. srvr
    1. version
    2. latencies
    3. received client requests
    4. sent client responses and notifications
    5. outstanding requests
    6. zxid, cluster id
    7. mode in cluster, leader or follower
    8. node count (?)
  2. stat
    1. similar to srvr
      1. but has actual connections listed by IP near top
Taken: http://phunt1.wordpress.com/2010/03/29/monitoring-zookeeper-3-3-even-more-cussin/

Friday, 20 September 2013

Set IPs on vagrant-lxc VMs

Cross-communication is always nice.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.define "web", primary: true do |web|
    web.vm.box = "quantal64"
    web.vm.provider :lxc do |lxc|
      lxc.customize 'network.ipv4', '10.0.3.100/32'
    end
  end

  config.vm.define "db" do |db|
    db.vm.box = "quantal64"
    db.vm.provider :lxc do |lxc|
      lxc.customize 'network.ipv4', '10.0.3.101/32'
    end
  end

end


FYI, versioning info:

vagrant -v
Vagrant 1.3.3

vagrant plugin list
vagrant-lxc (0.6.0)

Tuesday, 6 August 2013

vncserver on Amazon Linux on Amazon's AWS

NOTE: this first step may be outdated in new versions of Amazon Linux, which provides libjpeg-turbo.

First, get a good version of libjpeg-turbo:
  1. yum clean all
  2. yum --enablerepo=amzn-preview install libjpeg-turbo
  3. see: https://forums.aws.amazon.com/thread.jspa?threadID=121128
Necessary packages:
  1. gnutls-2.8.5-10.el6.x86_64.rpm
  2. libfontenc-1.0.5-2.el6.x86_64.rpm
  3. libtasn1-2.3-3.el6.x86_64.rpm
  4. libxdmcp-1.1.1-7.ram1.x86_64.rpm
  5. libXfont-1.4.5-2.el6.x86_64.rpm
  6. libxkbfile-1.0.6-1.1.el6.x86_64.rpm
  7. libXmu-1.1.1-2.el6.x86_64.rpm
  8. mesa-dri-drivers-9.0-0.7.el6.x86_64.rpm
  9. pixman-0.26.2-5.el6_4.x86_64.rpm
  10. tigervnc-license-1.3.0-16.el6.noarch.rpm
  11. tigervnc-server-1.3.0-16.el6.x86_64.rpm
  12. tigervnc-server-minimal-1.3.0-16.el6.x86_64.rpm
  13. xkeyboard-config-2.6-6.el6.noarch.rpm
  14. xorg-x11-proto-devel-7.6-25.el6.noarch.rpm
  15. xorg-x11-xauth-1.0.2-7.1.el6.x86_64.rpm
  16. xorg-x11-xkb-utils-7.7-4.el6.x86_64.rpm
Necessary packages for fluxbox:
  1. pyxdg-0.18-1.el6.noarch.rpm
Here's a link to all the packages needed: rpms

Start by trying to install tigervnc-server. That will fail. Follow the dependencies down, installing packages one by one as they come up. If they fail, install their dependencies first.

These packages were special cases
  1. mesa-dri-drivers-9.0-0.7.el6.x86_64.rpm
    1. just "--nodeps" install this one
    2. the libraries of the dependencies are never called from my experience
  2. libXtst-1.2.1-2.el6.x86_64.rpm
    1. there is a more recent version of this already in Amazon Linux, so just skip this one and "--nodeps" the parent package, which is libXmu-1.1.1-2.el6.x86_64.rpm
If not found, add location of libXdmcp.so.6 to /etc/ld.so.conf and run "ldconfig", e.g. locations is /usr/lib/libXdmcp.so.6 so add the line "/usr/lib".

Once I got the vncserver up with

  vncserver :66 -localhost

bizarrely, it was listening on port 5966 and some 6066 port. The 5966 port is the one you want.

See previous post on Redhat VNC for details, click here.

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...