Posts

Showing posts from 2015

htop: save configuration

To exit htop and save config in file:

F10
To find the config file just after you exit:

find -name '*htoprc*' -mmin -10

Slow loading mysql dump into RDS

It's the PIOPS, stupid. Try cranking them up, e.g. 300GB volume at 3000 IOPS on your RDS instance when you create it.

See if that helps.

I just went from load taking days to load taking only hours.

This is an official AWS collection point for data, so please leave a comment on your experience. jk.

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');

VirtualBox: port forwarding to guest from host

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


NetworkSet "NAT"Click "Port Forwarding""Insert new rule" (right-hand nav button)Rule 1Host IP: 127.0.0.1Host port: 2222Guest 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.

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

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 CPUsCache thrashing, a naive cache read/write exerciserDrive stress by writing and removing many temporary filesProcess creation and termination, just lots of fork() + exit() callsI/O syncs, just forcing lots of sync() callsVM stress via mmap(), memory write and munmap()Pipe I/O, large pipe writes and reads that exercise pipe, copying and context switchingSocket stressing, much like the pipe I/O test but using socketsContext switching between a pair of producer and consumer processes

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 …

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.

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'…