I found this wonderful output format for the MySQL CLI here. The command is mysql> pager less -SFX
. I would like this to be my default and not have to enter the command every time I start the MySQL CLI. How can I go about setting this as a default?
Tony's questions
I recently created a ZFS volume to test its compression capabilities. I'm comparing it side by side to an ext4 volume. After creating the new volume and turning compression on with sudo zfs set compression=gzip postgres-zfs
I copied a ~3GB file from the ext4 volume to the ZFS file but the file is the same exact size on the ZFS drive (I used ls -alh
to see this). I gzipped the file manually to see what the compression should be (I understand there are different levels but just to get a ballpark) and just using gzip file
the file size was cut in half. My ZFS settings also show compression is turned on:
# zfs get all
NAME PROPERTY VALUE SOURCE
postgres-zfs type filesystem -
postgres-zfs creation Thu Apr 5 17:17 2018 -
postgres-zfs used 1.54G -
postgres-zfs available 143G -
postgres-zfs referenced 1.54G -
postgres-zfs compressratio 1.34x -
postgres-zfs mounted yes -
postgres-zfs quota none default
postgres-zfs reservation none default
postgres-zfs recordsize 128K default
postgres-zfs mountpoint /postgres-zfs default
postgres-zfs sharenfs off default
postgres-zfs checksum on default
postgres-zfs compression gzip local
postgres-zfs atime on default
postgres-zfs devices on default
postgres-zfs exec on default
postgres-zfs setuid on default
postgres-zfs readonly off default
postgres-zfs zoned off default
postgres-zfs snapdir hidden default
postgres-zfs aclinherit restricted default
postgres-zfs canmount on default
postgres-zfs xattr on default
postgres-zfs copies 1 default
postgres-zfs version 5 -
postgres-zfs utf8only off -
postgres-zfs normalization none -
postgres-zfs casesensitivity sensitive -
postgres-zfs vscan off default
postgres-zfs nbmand off default
postgres-zfs sharesmb off default
postgres-zfs refquota none default
postgres-zfs refreservation none default
postgres-zfs primarycache all default
postgres-zfs secondarycache all default
postgres-zfs usedbysnapshots 0 -
postgres-zfs usedbydataset 1.54G -
postgres-zfs usedbychildren 132K -
postgres-zfs usedbyrefreservation 0 -
postgres-zfs logbias latency default
postgres-zfs dedup off default
postgres-zfs mlslabel none default
postgres-zfs sync standard default
postgres-zfs refcompressratio 1.34x -
postgres-zfs written 1.54G -
postgres-zfs logicalused 2.07G -
postgres-zfs logicalreferenced 2.07G -
postgres-zfs filesystem_limit none default
postgres-zfs snapshot_limit none default
postgres-zfs filesystem_count none default
postgres-zfs snapshot_count none default
postgres-zfs snapdev hidden default
postgres-zfs acltype off default
postgres-zfs context none default
postgres-zfs fscontext none default
postgres-zfs defcontext none default
postgres-zfs rootcontext none default
postgres-zfs relatime on temporary
postgres-zfs redundant_metadata all default
postgres-zfs overlay off default
Any idea why this data is not being stored compressed?
I was recently given a bunch of keys and a bunch of servers and had to do some detective work to figure out which key matched which server. After a few tries (maybe 3?) SSH locked me out. My guess is due to the MaxAuthTries
setting. We have tracked down the correct key but now I can't use it because of the error message:
Too many authentication failures for ubuntu
Authentication failed.
I thought restarting the server would work but no luck. Even trying to SSH in with root gives me the same error. It seems a bit weird that I would get completely locked out of a server due to this and it would never reset. Is there something I'm missing about how to reset this? It's actually hard to google for information about this because everyone experiencing this problem seems to have a bunch of keys in ~/.ssh
that a dumb client in cycling through but I am setting my key very specifically:
ssh <user>@<ip-address> -i /path/to/pem.pem
Thank you!
I have a fairly basic supervisor config:
[program:drape]
process_name=%(program_name)s_%(process_num)02d
command=python /home/ubuntu/drape/workers/drape.py
numprocs=1
autostart=true
autorestart=true
nocleanup=true
stdout_logfile=/home/ubuntu/supervisord.out.log
stdout_logfile_maxbytes=32MB
stderr_logfile=/home/ubuntu/supervisord.err.log
stderr_logfile_maxbytes=32MB
startsecs=180
I don't think this config actually matters but posting anyway. I'm using the stock supervisor global config. I installed supervisor via standard sudo apt-get -y install supervisor
...and just to be sure:
$ sudo apt-get -y install supervisor
Reading package lists... Done
Building dependency tree
Reading state information... Done
supervisor is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 69 not upgraded.
However, when I try to start supervisor, I get a completely silent failure:
ubuntu@...:~$ sudo service supervisor start
ubuntu@...:~$
There is nothing in the logs (My global config has logfile=/var/log/supervisor/supervisord.log
) and there is nothing in the "program logs" either (logfile=/var/log/supervisor/supervisord.log.<stream>.log
).
I have a similar provisioning process for other servers that run ruby daemons so to dig in a bit further, I even creating a very simple ruby script and made chmod 777
the thing so there are no permission issues:
$ cat test.rb
while 1
puts "hi"
sleep 1
end
$ ruby test.rb
hi
hi
hi
...
My question is more of a ..."where should I look" question. If supervisor isn't logging anything the only other place I can think to look of is the syslog which doesn't indicate anything crazy to me.
sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /data/postgres/9.1/main -D /data/postgres/9.3/main -o ' -c config_file=/etc/postgresql/9.1/main/postgresql.conf' -O ' -c config_file=/etc/postgresql/9.3/main/postgresql.conf'
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is a superuser ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Creating dump of global objects ok
Creating dump of database schemas
ok
New cluster database "flagstaff_subset" is not empty
Failure, exiting
I have no idea where to go from here. If anyone knows the root cause of this or has good instructions on upgrading from postgres 9.1 to 9.3, please let me know!
I'm following these instructions to upgrade postgres from 9.1 to 9.3: http://www.postgresql.org/docs/9.1/static/upgrading.html
When I restore (Step 8), I get a ton of messages like this:
psql:/mnt/dumps/pre-upgrade.dump:61028: invalid command \N
Does anyone know the problem or can point me to a better upgrade instructions for Linux?
I'm running an m1.xlarge
EC2 instance. According to EC2 specs, it should come with 4 x 420GB instance stores
. When I SSH into my new machine, I don't see any of these drives. All I see are my EBS volumes:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 1.6G 6.3G 21% /
devtmpfs 7.4G 52K 7.4G 1% /dev
tmpfs 7.4G 0 7.4G 0% /dev/shm
/dev/xvdf 197G 97G 91G 52% /data
/dev/xvdg 25G 3.2G 21G 14% /journal
/dev/xvdh 9.9G 151M 9.2G 2% /log
This is a Mongo server and I'd like to use instance storage as temporary space while backing up Mongo. How do I locate the 420GB instance stores and mount them? I've read the EC2 docs and I am still unclear.
Is this the correct syntax? It seems that Upstart is starting two instances of this daemon:
start on runlevel [2345]
stop on runlevel [06]
limit nofile 32768 32768
env DISPLAY=:0
respawn
script
[ -r /etc/default/splash ] && . /etc/default/splash
logdir=${SPLASH_LOGDIR:-/var/log/splash}
proxyprofilespath=${SPLASH_PROXYPROFILESPATH:-/etc/splash/proxy-profiles}
jsprofilespath=${SPLASH_JSPROFILESPATH:-/etc/splash/js-profiles}
maxrss=${SPLASH_MAXRSS:-$(awk '/MemTotal/{print $2*0.75/1024}' /proc/meminfo)}
cachepath=${SPLASH_CACHEPATH:-/var/cache/splash}
cachesize=${SPLASH_CACHESIZE:-512} # 512MB
chown proxy:proxy $logdir $proxyprofilespath $cachepath $jsprofilespath
# May need to figure out how to run this /usr/bin/xvfb-run --auto-servernum
exec start-stop-daemon --start \
--chuid proxy:proxy \
--pidfile /var/run/splash.pid \
--exec /usr/bin/xvfb-run /usr/bin/python -- \
-m splash.server \
--maxrss $maxrss \
--logfile $logdir/splash.log \
--proxy-profiles-path=$proxyprofilespath \
--js-profiles-path=$jsprofilespath \
--cache --cache-path=$cachepath --cache-size=$cachesize \
--manhole \
>$logdir/splash.out 2>$logdir/splash.err
end script
The ps -ef
...
proxy 701 1 0 21:45 ? 00:00:00 /bin/sh /usr/bin/xvfb-run /usr/bin/python -m splash.server --maxrss 1239.67 --logfile /var/log/splash/splash.log --proxy-profiles-path=/etc/splash/proxy-profiles --js-profiles-path=/etc/splash/js-profiles --cache --cache-path=/var/cache/splash --cache-size=512 --manhole
proxy 776 701 0 21:45 ? 00:00:05 /usr/bin/python -m splash.server --maxrss 1239.67 --logfile /var/log/splash/splash.log --proxy-profiles-path=/etc/splash/proxy-profiles --js-profiles-path=/etc/splash/js-profiles --cache --cache-path=/var/cache/splash --cache-size=512 --manhole
I have a file on server that can be written by a group. The group is called "deploy" and the user is "mima." I have verified "mima" is in "deploy" with:
$ id mima
uid=1001(mima) gid=1002(mima) groups=1002(mima),1000(wheel),1001(deploy)
The permissions on the file I want to edit are:
$ ls -l application_helper.rb
-rw-rw-r-- 1 deploy deploy 460 2012-08-13 21:30 application_helper.rb
This seems like it should work because the group deploy can write and mima is in that group, but I do get a permissions error.
I'm on my server and I can't ping anything outside. I tried for example google.com. How can I diagnose this issue? I can ping my localhost (ping works)
This is my traceroute to google.com:
[root@ip-10-112-63-16 tony]# traceroute google.com
traceroute to google.com (74.125.113.147), 30 hops max, 40 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
And this is the result of route -n:
[root@ip-10-112-63-16 tony]# /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.112.62.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
0.0.0.0 10.112.62.1 0.0.0.0 UG 0 0 0 eth0
And these are my iptables:
[root@ip-10-112-63-16 tony]# /sbin/iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
On my linux box I have the typical /etc/cron.hourly directory with scripts. I created one with the following simple code to run a ruby script:
#!/bin/bash
ruby /home/eltony/data_warehouse_scripts/import.rb
While I can look at /var/log/cron.log and verify the hourly cron is running, the script never executes. I'm not sure exactly why, but I am sure that when I type that command into my CLI and hit enter, the script runs and does what it should.
I'm not really sure how to debug this issue so any help would be great. The permissions seem fine because they are the same as all of the scripts in cron.hourly and cron.monthly:
-rwxr-xr-x 1 root root 65 Jun 3 12:53 le_warehouse_sync
-rwxr-xr-x 1 root root 268 Nov 9 2009 mcelog.cron
Thanks!
After a long time wasted trying to get Bluepill to work for process management, I'm trying to get monit set up. I'm not a Sys Admin but know my way around *nix systems. I'm a bit stumped here.
When I run the command to restart all monit processes I get this output:
rails@george:/srv/fsg_distro$ sudo monit restart all
'delayed_job' trying to restart
'delayed_job' start: /usr/bin/env
delayed_job: process with pid 16901 started.
'delayed_job' failed to start
'george' trying to restart
However the process is not running when I check with PS. Not to mention it's not doing what it's supposed to so I'm pretty sure it's not working.
Then when I try to reload monit I get this:
rails@george:/srv/fsg_distro$ sudo monit reload
Reinitializing monit daemon
monit: No daemon process found
even though I have a conf:
rails@george:/srv/fsg_distro$ ls /etc/monit/conf.d/
george.conf
Any idea how to troubleshoot this issue?
I was trying to install homebrew and very very stupidly did this:
sudo chown -R $USER /usr/local
The Homebrew instructions say to do this and I'm not much of a sysadmin so I took their word for it. Lesson learned (although I wouldn't really know how to test this...seems like an "undo" script would be super valuable here)
Anyway, what is done is done, but now I get this error:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 548
Server version: 5.1.33 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
I tried chown-ing back to root with no avail. Does anyone know how I can fix this without reinstalling mysql? Optionally, if I have to reinstall mysql, how can I dump my databases without access to the command line so I don't lose all of my data.
Thanks!
I have a user ftpadmin:
-bash-3.2$ id ftpadmin
uid=10001(ftpadmin) gid=2525(fsg) groups=2525(fsg),10005(git)
The important group to note is "git"
Then I have my git repository:
ls -al
drwxrwxr-x 7 git git 4096 Apr 20 14:17 fsg
So ftpadmin is a member of git, and git has given all permissions to people in the group. Why do I see this when I login as ftpadmin:
-bash-3.2$ ls -al /home/git/
ls: /home/git/fsg: Permission denied
...
Seems like I should have permission...
Update The permissions on /home/git are
drwxrw-rw- 6 git git 4096 Apr 26 09:20 git
still looks good...
Update New permissions on /home/git are:
drwxrwxrw- 6 git git 4096 Apr 26 09:20 git
Permissions on /home/git/fsg are:
drwxrwxr-x 7 git git 4096 Apr 20 14:17 fsg
However, I still get
ls: /home/git/fsg: Permission denied
ls: /home/git/fsg: Permission denied
I often get a "premature end of script headers" error in my apache log which results to an internal 500 error. I understand what the error message means - that my application did not give the browser the headers it needs (and maybe nothing at all), but the odd thing is that this does not happen all the time. It actually usually happens the first few times I go to my website after a deploy. Could this be a memory issue? Does anyone know how to trouble shoot this? My apache log isn't really telling me anything.
I am running a ruby site using the rails framework on ubuntu hardy.
thank you!