Page:
Server Notes
Pages
APT WhatProvides
Apache wpadmin
Arch Default Kernel
Arch Kernel Order
Bash Add fd
Bash Dump History
Bash Trim Whitespace
CPU Stats
CSS Reset
DB2 Info
Debian Upgrade
Dell OpenManage
Diff Lines
Favicon Things
Find Examples
Forgejo Syntax Highlight
Git Combine Repos
Git Multi SSH
Git Quickstart
Git Rewrite User
GitLab Anchors
Gitea Mirror
Glibc IPv4
GnuPG Things
Home
IMAP Sync
IPv4 Default Gateway
IPv4 Default IP
KRB5 Empty Keytab
Kernel Boot Debug
Kernel Decompress
LICENSE
LUKS Encrypted Partitions
Linux Valid Usernames
Loopback FS
MP3 Get Tags
MX Tarpit
Makefile Template
Markdown Samples
Mount OVA
Mount qcow2
MySQL Connections
NFS 10G Tuning
Netcat Replacements
PAM Namespace
Postfix Headers
Proxmox Doodads
RPM Info
Radeon Temperature
Recover Deleted ext3
Recursive Unzip
Roku Info
SSH RSA Support
SSL Certgen
Samba OSX
Server Notes
Smem Datamash
Split Disk
TCP Kill
Thunderbird LDAP AD
Weechat Quickstart
YTM to Textbox
YUM Disablerepos
systemd PID1
uBlock Filters
udev Hide Partitions
No results
2
Server Notes
tengel edited this page 2024-09-05 08:27:27 -05:00
Random server oriented notes, all over the map
Device Mapper:
lvdisplay|awk '/LV Name/{n=$3} /Block device/{d=$3;sub(".*:","dm-",d);print d,n;}'|sort -nk 3
dmsetup ls|awk '{n=$1;d=$3;sub(")","",d); printf("dm-%s %s\n",d,n);}'|sort -nk 3
ISO Images with Linux
=====================
genisoimage -f -J -joliet-long -r -allow-lowercase -allow-multidot \
-o foobar.iso path_to_directory_with_files
Notify / inotify
================
ps $(find /proc/*/fd/* -type l -lname 'anon_inode:inotify' 2>/dev/null \
| sed 's+/proc/\([^/]*\)/fd/.*+\1+')
echo 1 > /sys/kernel/debug/tracing/events/syscalls/sys_exit_inotify_add_watch/enable
cat /sys/kernel/debug/tracing/tracing_on
grep -c inotify_add_watch /sys/kernel/debug/tracing/trace
echo 0 > /sys/kernel/debug/tracing/events/syscalls/sys_exit_inotify_add_watch/enable
VirtualBox
==========
$ vboxmanage showmediuminfo disk source.vhdx
$ vboxmanage clonemedium disk source.vhdx dest.vdi
LVM cluster volume work
=======================
https://access.redhat.com/solutions/3618
vgchange -cn --config 'global {locking_type=0}' vgsan00
Capture bash history of logged in user
======================================
PID=1234; gdb -batch --eval "set sysroot /" --eval "attach ${PID}" \
--eval "call write_history(\"/tmp/history-${PID}.txt\")" \
--eval 'detach' --eval 'q'
Add to glibc
============
MYGLIBC=$(rpm -q --queryformat='%{version}-%{release}\n' glibc | uniq)
yum --showduplicates --disableexcludes=all install nscd-${MYGLIBC}
RHEL Cluster check
==================
xmllint -relaxng /usr/share/cluster/cluster.rng /etc/cluster/cluster.conf
Tomcat SSL
==========
http://www.digicert.com/ssl-certificate-installation-tomcat.htm
- keyAlias="tomcat" keystoreFile="tomcat.jks" keypass="tomcat"
# openssl pkcs12 -export -name tomcat -in tomcat.crt -inkey tomcat.key -out tomcat.p12 -CAfile GeoTrust_Inc.cabundle -caname root
# keytool -importkeystore -destkeystore tomcat.jks -srckeystore tomcat.p12 -srcstoretype pkcs12 -alias tomcat
# keytool -list -v -keystore tomcat.jks
SSL cert checks
===============
openssl x509 -in XXX.crt -text | grep CN=
openssl x509 -modulus -noout -in XXXX.crt | openssl md5
openssl rsa -modulus -noout -in XXXX.key | openssl md5
Oracle nifties
==============
$ lsnrctl status <ID>
$ ps -ef|grep pmon |grep -vi grep|grep -vi asm (Oracle ASM)
$ ps -ef|grep crs (Oracle RAC)
$ su - oracle
$ sqlplus / as sysdba (it will show RAC is installed)
$ select * from gv$active_instances; (verify 100% if there is RAC)
http://docs.oracle.com/cd/B28359_01/server.111/b31107/asmdiskgrps.htm#CHDIBGGH
oracle database size check
-------------------------------
--- Acutal size of segments i.e. tables/indexes
select sum(bytes)/(1024*1024*1024) from dba_segments;
select sum(bytes)/(1024*1024*1024) from dba_data_files;
-- total size of data files
crosscheck
--------------------------------------
Login to “rman target backupadmin/pwd@tns catalog cname/passwd@catalog” once you get “RMAN>” prompt, please run the following:
RMAN> Crosscheck ARCHIVELOG ALL;
oracle query for list of the tablespaces
--------------------------------------
select tablespace_name, CONTENTS from dba_tablespaces;
oracle query for list of datafiles
--------------------------------------
SELECT NAME, FILE#, STATUS, CHECKPOINT_CHANGE# "CHECKPOINT" FROM V$DATAFILE;
https://docs.oracle.com/cd/B28359_01/server.111/b28310/dfiles010.htm#ADMIN11459
https://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_1076.htm#REFRN30050
ASM disk timeouts
SQL> select name,value,describe from v$asm_hidden_paras;
NAME VALUE DESCRIBE
--------------------------------------- -------- ----------------------------------------------------------------------
_asm_acd_chunks 1 initial ACD chunks created
[...]
_asm_global_dump_level 267 System state dump level for ASM asserts
_asm_hbeatiowait 15 number of secs to wait for PST Async Hbeat IO return
_asm_hbeatwaitquantum 2 quantum used to compute time-to-wait for a PST Hbeat check
SCSI Device Ops
===============
echo "- - -" > /sys/class/scsi_host/hostX/scan where X is your HBA
echo 1 > /sys/block/sdX/device/rescan where X is your device number
echo 1 > /sys/block/sdX/device/delete where X is your device number
MySQL Things
============
MySQL slave check:
mysql -e "show slave status\G;" | awk '/Slave_IO_Running|Slave_SQL_Running|Seconds_Behind/'
MySQL killer for AmReg:
for x in `mysqladmin processlist | grep -i select | awk -F"|" ' $7 > 30 { print $2 }'` ; do mysqladmin kill $x ; done
MySQL real DB size by DB:
SELECT table_schema "Name", sum( data_length + index_length ) / 1024 / 1024 / 1024 "Size in GB" FROM information_schema.TABLES GROUP BY table_
schema;
MySQL real DB size by Engine:
select engine,count(*),sum(index_length+data_length)/1024/1024 from information_schema.tables group by engine;
MySQL table size of a single table:
SELECT table_name,`engine`,ROUND(data_length/1024/1024,2) total_size_mb,ROUND(index_length/1024/1024,2) total_index_size_mb, table_rows FROM information_schema.TABLES WHERE table_schema = 'threadless' and table_name = 'users';
MySQL flush buffers for shutdown:
# mysql -e "flush logs;"
# mysql -e "SET @@global.innodb_max_dirty_pages_pct = 0;"
# mysql -e "show global status like ‘Innodb_buffer_pool_pages_dirty’;"
## mysqladmin ext -i10 | grep dirty
MySQL increase connections:
gdb -p $(cat /var/run/mysqld/mysqld.pid) -ex "set max_connections=5000" -batch
Some low disk things
Low Disk (current directory, w/top 20 on largest directories)
FS="$PWD";resize;clear;date;df -h $FS; echo "Largest Directories:"; nice -n19 find $FS -mount -type d -print0 2>/dev/null|xargs -0 du -k 2>/dev/null|sort -runk1|head -n20|awk -F'\t' '{printf "%8d MB\t%s\n",($1/1024),$NF}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -print0 2>/dev/null| xargs -0 du -k | sort -rnk1| head -n20 |awk -F'\t' '{printf "%8d MB\t%s\n",($1/1024),$NF}';
Low Disk (current directory, takes into account sparse files)
FS='./';resize;clear;date;df -h $FS; echo "Largest Directories:"; du -hcx --max-depth=2 $FS 2>/dev/null | grep [0-9]G | sort -grk 1 | head -15 ;echo "Largest Files:"; nice -n 19 find $FS -mount -type f -print0 2>/dev/null| xargs -0 du -k | sort -rnk1| head -n20 |awk -F'\t' '{printf "%8d MB\t%s\n",($1/1024),$NF}'
Index
- APT WhatProvides
- Apache wpadmin
- Arch Default Kernel
- Arch Kernel Order
- Bash Add fd
- Bash Dump History
- Bash Trim Whitespace
- CPU Stats
- CSS Reset
- DB2 Info
- Debian Upgrade
- Dell OpenManage
- Diff Lines
- Favicon Things
- Find Examples
- Forgejo Syntax Highlight
- Git Combine Repos
- Git Multi SSH
- Git Quickstart
- Git Rewrite User
- Gitea Mirror
- GitLab Anchors
- Glibc IPv4
- GnuPG Things
- IMAP Sync
- IPv4 Default Gateway
- IPv4 Default IP
- KRB5 Empty Keytab
- Kernel Boot Debug
- Kernel Decompress
- LUKS Encrypted Partitions
- Linux Valid Usernames
- Loopback FS
- MP3 Get Tags
- MX Tarpit
- Makefile Template
- Markdown Samples
- Mount OVA
- Mount qcow2
- MySQL Connections
- NFS 10G Tuning
- Netcat Replacements
- PAM Namespace
- Postfix Headers
- Proxmox Doodads
- RPM Info
- Radeon Temperature
- Recover Deleted ext3
- Recursive Unzip
- Roku Info
- SSH RSA Support
- SSL Certgen
- Samba OSX
- Server Notes
- Smem Datamash
- Split Disk
- systemd PID1
- TCP Kill
- Thunderbird LDAP AD
- uBlock Filters
- udev Hide Partitions
- Weechat Quickstart
- YTM to Textbox
- YUM Disablerepos
- SPDX-License-Identifier: CC-BY-SA-4.0
- SPDX-License-Identifier: MIT