Thursday, 25 June 2015

create simple mysql table for testing

CREATE TABLE suppliers (
    SupplierID SMALLINT UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
    SupplierName VARCHAR(40) NOT NULL,
    Phone VARCHAR(14) NOT NULL,
    Email VARCHAR(60) NULL,
    PRIMARY KEY (SupplierID)
 );

INSERT INTO suppliers (SupplierName, Phone, Email) VALUES ('ABCSupplier','1122334455','abc@dicforum.com');

Monday, 22 June 2015

VirtualBox: port forwarding to guest from host

Something weird in the new (2015-06) version.


  • Network
    • Set "NAT"
    • Click "Port Forwarding"
    • "Insert new rule" (right-hand nav button)
      • Rule 1
        • Host IP: 127.0.0.1
        • Host port: 2222
        • Guest IP: [leave blank]
        • Guest Port: 22
To get to guest:

ssh -p 2222 myuser@localhost

where myuser is user you created when you installed Linux OS on to VM.

Monday, 1 June 2015

Connect to remote JMX over ssh and jconsole

ssh -N -f -D 7777 dev-cass-10.mydomain.internal

jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=7777 service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi

Friday, 22 May 2015

Stress Linux system: stress-ng

worthy: stress-ng

NOTE: it's the newer/better version of "stress"

Quote:

stress-ng current contains the following methods to exercise the machine:
  • CPU compute - just lots of sqrt() operations on pseudo-random values. One can also specify the % loading of the CPUs
  • Cache thrashing, a naive cache read/write exerciser
  • Drive stress by writing and removing many temporary files
  • Process creation and termination, just lots of fork() + exit() calls
  • I/O syncs, just forcing lots of sync() calls
  • VM stress via mmap(), memory write and munmap()
  • Pipe I/O, large pipe writes and reads that exercise pipe, copying and context switching
  • Socket stressing, much like the pipe I/O test but using sockets
  • Context switching between a pair of producer and consumer processes

Wednesday, 20 May 2015

Interview: sysadmin

Command line tools

Which tools have you used in below categories? With which options? What do the options perform? (possible answers/options listed after category)

  * network tools

    * iftop: n, N, P
    * lsof: i, p, c, N, P
    * tcpdump: n, host, net, and, or
    * iptables: t, L, n, D
    * dig: txt, mx, a, cname
    * ping
    * traceroute/mtr

  * filesystem tools

    * df: h, a, s, T
    * du: s, h
    * fdisk: l
    * mkfs
    * find: exec, name, type
    * updatedb/locate

  * monitoring tools / process management

    * watch: d, n
    * ps: a, u, x, w
    * htop
    * vmstat: <seconds>
    * sa/sar
    * nice
    * smartctl
    * iostat: <seconds>, x, m


* Filesystems

  * Which are the types of filesystems: ext3, ext4, xfs, brtfs
  * What is an inode? How would you handle a "disk full" error related to inodes usage?


* Networking

  * What is port forwarding and how have you used it?
  * What is CIDR, show examples?
  * What is NAT? How have you used NAT technology?
  * What are the types of protocols? Explain their use. (tcp, udp, icmp)
  * Which hardware/software firewalls have you used? Explain.
  * Have you used VPN technology? Explain what was done and how you were involved.


* AWS

What is your experience with AWS? Detail/diagram projects.

Which AWS technologies have you used?

  * EC2

    * How have you managed AWS servers: API, web interface, command line tools?
    * Which types of instances have you used?
    * How many servers were you responsible for?
    * What is the difference between EBS and ephemeral storage? Pros/cons.

  * EBS

    * Which parameters does volume creation require?
    * What is a snapshot? How are redundant blocks stored for subsequent snapshots?

  * ELB

    * What is the "health check" used for? What are the parameters
    * Have you used SSL with ELB?
    * What are "listeners"?
    * Have you used ELB in conjunction with haproxy. Diagram.

  * VPC

    * How did you use VPC? Have you setup a AWS VPC from scratch?
    * Do you know what a "DHCP option set" is? How is it used?
    * Diagram what subnets were used, which were public, and which private.

  * SES

    * What is a "verified" email or domain in SES?

  * Route 53

    * Have you created a domain in Route 53?
    * Have you maintained DNS records with Route 53?
    * What does Route 53 offer that other DNS services do not?
    * How does Route 53 integrate with AWS ELB technology?

Monitoring

  * CloudWatch

    * How did you use CloudWatch to monitor server health and network use
    * Did you ever setup a CloudWatch email alert? Explain steps involved.

  * Zenoss

    * What are the tools you used in Zenoss
    * How large was the monitored infrastructure?
    * What is a Zenoss event?

  * On-call

    * Talk about your past on-call experiences, and one time handled a major issue
    * What are the available paging services, and which have you used?

Java

  * What experience do you have installing/supporting Java?
  * Explain how you performed JVM monitoring.
  * Tomcat
    * Have you ever supported Tomcat? What were the configurations you were responsible for?
    * What are the core Tomcat configuration files? Log files?
  * What is the Java Heap? How can this be set/modified, and what are the effects? Downsides?
  * What steps would you take to debug/resolve a "Out of Memory" JVM error?

Cassandra

  * Explain your experience with Cassandra. Versions?
  * How many nodes did you support? What percent of the data load was each node responsible for?
  * nodetool: what are the options, and what do they show/perform?
  * Explain how you built a ring from the ground up in the past
  * What steps did you take to monitor your Cassandra nodes?
  * What steps did you take for a node failure?
  * How did you find/get answers to questions you had on the Cassandra techonology?

Tuesday, 5 May 2015

Google Nexus 4: permanent back panel glass repair for less than a penny

Clear packing tape. Apply single layer everywhere on back panel there isn't a device port. Be creative.

Has worked for me for months to prevent further damage.

Cost less than $ 0.01.

Doesn't look "pro" but neither do $20 - $30 covers from Toys-R-Us and other similar stores.

I actually only covered the area below the camera and to the left of the speak/microphone/whatever with one single piece I had to cut a bit to size.

Tuesday, 27 January 2015

Cassandra: links to snapshots in one place

Use rsync with '-L' to copy elsewhere.

#!/usr/bin/ruby

require 'fileutils'

mybasedir = '/var/lib/cass'
mydatadir = mybasedir + '/data'
mysnapshotlinksdir = mybasedir + '/snapshots'
FileUtils.remove_dir(mysnapshotlinksdir) if File.exists?(mysnapshotlinksdir)
Dir.chdir mydatadir
mysnapshotdirs = Dir.glob("**/*/")
mysnapshotdirs = mysnapshotdirs.grep(/snapshots\/.+/)
#p mysnapshotdirs

mysnapshots = {}
mysnapshotdirs.each do |mydir|
    mysnapshot = {}
    myparts = mydir.split('/')
    mysnapshot['keyspace'] = myparts[0]
    mysnapshot['cf'] = myparts[1]
    mysnapshot['tag'] = myparts[3]
    mysnapshot['linkdir'] = [mysnapshotlinksdir, mysnapshot['tag'], mysnapshot['keyspace']].join('/')
    mysnapshot['link'] = [mysnapshotlinksdir, mysnapshot['tag'], mysnapshot['keyspace'], mysnapshot['cf']].join('/')
    mysnapshot['target'] = [mydatadir, mydir].join('/')
    #p mysnapshot
    FileUtils.mkpath mysnapshot['linkdir'] unless File.exists?(mysnapshot['linkdir'])
    File.symlink(mysnapshot['target'], mysnapshot['link']) unless File.symlink?(mysnapshot['link'])
end

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...