Hackfix mysql replication
If replication is broken by a simple invalid query, i.e. grants change, etc. you can force-skip that query:
stop slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
start slave;
show slave status\G
s3 get size of bucket
s3cmd du s3://bucket-name | awk '{print $0/1024/1024/1024" GB"}'
Add MongoDB 2.4 user
Following good practice we put user credentials into the non-replicated admin
database. Note the empty role array for admin
.
$ use admin
$ db.auth('root','***')
$ db.addUser({user:'new_user',pwd:'***',otherDBRoles: { peachy_prod: ['read']}, roles: []})
We then reference the new user in the actual db.
$ use peachy_prod
$ db.addUser({user:'new_user',userSource:'admin', roles: ['read']})
Now we can auth against the admin
database and obtain the authorization to access the actual db.
$ use admin
$ db.auth('new_user...
Setup Pentaho ETL server Linux
Todo
- rotate logs
- startup script for carte server
Software
- Setup centos 6.5
- set hostname in /etc/hosts
- start sshd
- turn off iptables
- add EPEL repo
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
- yum install htop acpi iotop iftop ftop wget man mlocate
- create users pentaho and postgres
- Java setup package via http://wiki.centos.org/HowTos...
chef & knife - use knife ssh
Example
knife ssh -x sysadmin.a -a ipaddress "chef_environment:stage" uptime
- always define the user with
-x
- always give the ssh attribute
-a ipaddress
for knife to rely on the ip attributes of the search query result - the actual search query goes along standard
knife search
syntax - remember quotes around constructed commands, in particular
sudo do_this
Bash, Shell - loop over directories
for dir in /tmp/*/
do
dir=${dir%*/}
echo ${dir##*/}
done
Rsync tips
rsync --partial --progress --rsh=ssh user@host:remote_file local_file
https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
Grep lines not starting with ; or [ first ^ for start, second ^ for "not"
grep "^[^;[]" /etc/php.ini | less
download Oracle Java with wget from command line
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm"
Untitled notedelete a line by sed, make it permanent via tmp file
sed -i".bak" '3d' filename.txt
Using the Job Control of bash to send the process into the background
- Ctrl+Z to stop (pause) the program and get back to the shell
-
bg
to run it in the background. -
disown -h [job-spec]
where [job-spec] is the job number (like %1 for the first running job; find about your number with the jobs command) so that the job isn't killed when the terminal closes
Add persistent route on CentOS
Create route-ethX file in: /etc/sysconfig/network-scripts/
ADDRESS0=x.x.x.x
NETMASK0=x.x.x.x
GATEWAY0=x.x.x.x
Example: We want to route two networks
192.168.6.0/24 and 192.168.5.0/24 through 10.10.16.231
ADDRESS0=192.168.6.0
NETMASK0=255.255.255.0
GATEWAY0=10.10.16.231
ADDRESS1=192.168.5.0
NETMASK1=255.255.255.0
GATEWAY1=10.10.16.231
NB: Do not forget to increment the number for every route:
ADDRESS(X)
NETMASK(X)
GATEWAY(X)
Printer setup Canon MF8350Cdn
General info for Linux users
Although the printer can be found and installed, a driver installation from below source is usually necessary.
Resize Proxmox disk space
Quick
- add space via gui
- delete old, create bigger new one
- resize filesystem
Helpful links
Tips
- when resizing boot partitions, remember to reboot after partition size change
- add NFS shares via WebGUI
- relevant config files: /etc/pve/storage.cfg
- on windows 7 servers, don't do resizing adjustment OS-side over rdp session, but via proxmox vnc terminal (possible permissions issue of RDP)