Created
May 1, 2012 14:53
-
-
Save sandys/2568516 to your computer and use it in GitHub Desktop.
raid setup on providerservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get data about current RAID | |
#1 block = 1kb | |
cat /proc/mdstat | |
mdadm --detail --scan | |
#to get to the real fstab | |
mount /dev/md1 /tmp/1 | |
vi /tmp/1/etc/fstab #find out the md # of the partition that u want to reformat | |
mdadm --detail /dev/md6 #more details about that partition, especially the /dev/sda6 + /dev/sdb6 info | |
mdadm --stop /dev/md6 #STOP ALL MD partitions (gotten from --scan) | |
fdisk /dev/sda -> delete partition 6 -> create 2 new partitions -> set type to "fd" -> write | |
fdisk /dev/sdb -> delete partition 6 -> create 2 new partitions -> set type to "fd" -> write | |
#create new raid partitions | |
mdadm --create --auto=yes --verbose /dev/md6 --level=1 --raid-devices=2 /dev/sda6 /dev/sdb6 | |
mdadm --create --auto=yes --verbose /dev/md7 --level=1 --raid-devices=2 /dev/sdb7 /dev/sda7 | |
watch cat /proc/mdstat # to check status | |
#start all raid devices | |
mdadm --assemble --scan --auto=yes # will follow /etc/mdadm/mdadm.conf . so add additional entries there | |
#setup xfs | |
mkfs.xfs -d sunit=512,swidth=1024 /dev/md6 | |
mkfs.xfs -d sunit=512,swidth=1024 /dev/md7 | |
#correct the filesystem config of the system | |
mount /dev/md1 /tmp/1 | |
# add to /etc/fstab | |
/dev/md6 /home xfs noattr2,noatime,nodiratime,osyncisdsync,logbsize=256k,logbufs=8,sunit=512,swidth=1024 0 2 | |
/dev/md7 /data xfs noatime,sunit=512,swidth=1024 0 2 | |
mdadm --detail --scan > /tmp/1/etc/mdadm/mdadm.conf | |
#unmount the mounted fs | |
umount /tmp/1 | |
#reboot | |
#install 3.0 kernel for improvements to XFS, etc. | |
apt-get install linux-image-3.0.0-19-server | |
### Tune XFS | |
#xfs information | |
xfs_info /dev/md6 | |
#benchmark | |
sysbench --test=fileio --file-num=1 --file-total-size=1GB --file-test-mode=rndwr --max-requests=0 --file-fsync-freq=0 --file-extra-flags=direct --num-threads=8 --max-time=30 run | |
#turn off write caching | |
hdparm -W0 /dev/sdb | |
hdparm -W0 /dev/sda | |
#check for fragmentation | |
xfs_db -c frag -r /dev/md6 | |
#defrag | |
xfs_fsr -v -t 600 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/hdparm.conf | |
command_line { | |
hdparm -W0 /dev/sda | |
hdparm -W0 /dev/sdb | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/sysctl.conf | |
#for postgresql | |
kernel.shmall=2097152 | |
kernel.shmmax=1134217728 | |
# General gigabit tuning: | |
net.core.rmem_max = 16777216 | |
net.core.wmem_max = 16777216 | |
net.ipv4.tcp_rmem = "4096 87380 16777216" | |
net.ipv4.tcp_wmem = "4096 65536 16777216" | |
#timewait sockets | |
net.ipv4.tcp_tw_reuse = 1 | |
net.ipv4.tcp_tw_recycle = 1 | |
#firewall conntrack | |
net.ipv4.netfilter.ip_conntrack_max = 1048576 | |
net.nf_conntrack_max = 1048576 | |
# this gives the kernel more memory for tcp | |
# which you need with many (100k+) open socket connections | |
net.ipv4.tcp_mem = "50576 64768 98152" | |
#SACKs are an optimization to TCP which in normal scenarios improves considerably performance. | |
#In Gigabit networks with no traffic competition these have the opposite effect. | |
#To improve performance they should be turned off by: | |
net.ipv4.tcp_sack = 0 | |
# Decrease the time default value for tcp_fin_timeout connection | |
net.ipv4.tcp_fin_timeout = 15 | |
# Decrease the time default value for tcp_keepalive_time connection | |
net.ipv4.tcp_keepalive_time = 1800 | |
# Turn off the tcp_window_scaling | |
# Helps in some cases. You can play with it | |
#net.ipv4.tcp_window_scaling = 0 | |
#increased backlog (default: 1000) | |
#if you are under DDoS you can get them up to 65535 | |
net.core.netdev_max_backlog = 4096 | |
net.core.somaxconn = 4096 | |
#Timestamp adds additional 12 bytes to header, so disable it | |
net.ipv4.tcp_timestamps = 0 | |
#portrange for outgoing connections | |
#(increase the ephemeral port range) | |
net.ipv4.ip_local_port_range="1024 65535" | |
# Unicorn advised tunning | |
net.ipv4.tcp_orphan_retries = 1 | |
net.ipv4.tcp_max_orphans = 8192 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#for 8GB RAM | |
shared_buffers = 1GB | |
maintenance_work_mem = 200MB | |
wal_buffers = 16MB | |
effective_cache_size = 4GB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment