mplayer -vo jpeg tomb.raider.sample.mpg
Videodan resim oluşturmak
Temmuz 15, 2013 § Yorum yok § Kalıcı bağlantı
Bazı Linux Admin Komutları
Temmuz 8, 2013 § Yorum yok § Kalıcı bağlantı
Processlerin güç kullanımı
sudo powertop -d
Ekran görüntüsünü yakalamak:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -vcodec mpeg2video -ar 44100 -s wvga -y -sameq desktop.mpg
Açık internet bağlantılarını tesbit etmek
fatih@fatih:~$ lsof -P -i -n COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME firefox 2544 fatih 39u IPv4 233241 0t0 TCP 10.1.21.9:51613->173.254.28.135:80 (ESTABLISHED) firefox 2544 fatih 44u IPv4 229228 0t0 TCP 10.1.21.9:59468->184.72.204.221:80 (ESTABLISHED) firefox 2544 fatih 56u IPv4 228053 0t0 TCP 10.1.21.9:41984->74.125.224.239:443 (ESTABLISHED) firefox 2544 fatih 63u IPv4 229229 0t0 TCP 10.1.21.9:40146->54.224.52.183:80 (ESTABLISHED) firefox 2544 fatih 87u IPv4 228125 0t0 TCP 10.1.21.9:52492->173.194.39.137:443 (ESTABLISHED) firefox 2544 fatih 90u IPv4 219045 0t0 TCP 10.1.21.9:52872->108.168.151.6:80 (ESTABLISHED)
İşletim sisteminin 32-64 bit olmasının tesbiti
$ getconf LONG_BIT 64 64
Traceroute ve ping peraber kullanan bir tool
mtr google.com
Dosya içeriğini silmek için
> 1.txt
Vi’da izinsiz dosyaları değiştirmek için
:w !sudo tee %
History’de görünmeden komut çalıştırmak için
<space> command
Dışa çıkan ip’yi öğrenmek için
curl ifconfig.me/all veya curl ifconfig.me
Buffer Cache Silmek
Temmuz 5, 2013 § Yorum yok § Kalıcı bağlantı
Linux arada bir kendi buffer cacheni temizlemekte.
Yinede ihtiyaç olursa bu işi elle yapmak için
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
Centos Cluster Testi
Temmuz 1, 2013 § Yorum yok § Kalıcı bağlantı
Cluster testi:
Zaman verisini cluster ip ye basıyorum ve clientlerda gelen bilgiyi dosyaya yazıyorum.
client dosyası
fatih@fatih:~$ cat client.sh while : do nc -l 1234 done fatih@fatih:~$ bash client.sh > deneme1.txt
Servisi taşıyacağımız clientda da
fatih@fatih:~$ bash client.sh > deneme2.txt
Server dosyası
fatih@fatih:~$ cat server.sh while : do date +'%Y-%m-%d %H:%M:%S.%N' | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9]$//g' | nc cluterip 1234 done fatih@fatih:~$ bash server.sh
Şimdi cluster ip’yi bir sunucudan diğerine taşıyorum
clusvcadm -r "IP" -m deneme1
Oluşan sonuç dosyaları
fatih@fatih:~$ cat deneme2.txt 2013-07-01 14:46:59.573 2013-07-01 14:46:59.630 2013-07-01 14:46:59.667 2013-07-01 14:46:59.725 2013-07-01 14:46:59.765 2013-07-01 14:46:59.812 2013-07-01 14:46:59.860 2013-07-01 14:46:59.928 2013-07-01 14:46:59.972 2013-07-01 14:47:00.040 2013-07-01 14:47:00.087 2013-07-01 14:47:00.153 2013-07-01 14:47:00.258 2013-07-01 14:47:00.321 2013-07-01 14:47:00.369 2013-07-01 14:47:00.410 2013-07-01 14:47:00.476 2013-07-01 14:47:00.525 2013-07-01 14:47:00.593 2013-07-01 14:47:00.644 2013-07-01 14:47:00.686 2013-07-01 14:47:00.743 2013-07-01 14:47:00.793 fatih@fatih:~$ cat deneme1.txt 2013-07-01 14:47:21.862 2013-07-01 14:47:21.889 2013-07-01 14:47:21.904 2013-07-01 14:47:21.929 2013-07-01 14:47:21.954 2013-07-01 14:47:21.978 2013-07-01 14:47:21.994 2013-07-01 14:47:22.025 2013-07-01 14:47:22.043 2013-07-01 14:47:22.063 2013-07-01 14:47:22.085 2013-07-01 14:47:22.115 2013-07-01 14:47:22.126
Sonuç: Cluster servisinin başlaması 21-22 saniye sürmekte.
Not:Virtualbox’da Centos 6.4 üzerinde 512mb ram, 2.4 Ghz tek core işlemcili sanal makinada test edildi.
Ağda Stream Edilen Videoyu Yakalamak!
Haziran 28, 2013 § Yorum yok § Kalıcı bağlantı
Mplayer ile
mplayer -dumpstream udp://10.1.21.9:1234 -dumpfile sonuc.dump
ffmpeg ile
ffmpeg -i udp://10.1.21.9:1234 -acodec copy -vcodec copy sonuc.dump
vlc ile
cvlc -vvv udp://@172.16.101.131:5000 --start-time=00 --run-time=10 --sout file/ts:test3.ts
Centos Cluster Yapımı, Arsadan Anahtar Teslim!
Haziran 26, 2013 § Yorum yok § Kalıcı bağlantı
Yeni bir Centos kurduk
ETH0 açılışta ayağa kalksın
vi /etc/sysconfig/network-scripts/ifcfg-eth0 ONBOOT=yes
eth0’ın routing ayarlarını yapalım
vi /etc/sysconfig/network-scripts/route-eth0 GATEWAY0=10.1.21.1 NETMASK0=255.255.255.0
Diğer network ayarları
vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=deneme4 GATEWAY=10.1.21.1
NetworkManager müdehalesini önleyelim
chkconfig NetworkManager off | service NetworkManager stop
iptables’ı kapatalım. Daha sonra açıp ayarlanabilir.
chkconfig iptables off service iptables stop
ntp servisi çalışsın ki sunucular saati bilsin
chkconfig ntpd on service ntpd start
selinux’ü iptal edelim
vi /etc/selinux/config SELINUX=disabled ayrıca konsoldan setenforce 0
epel paketi ile depo ekleyelim. High Availability paketlerini kuralım
rpm -Uvh /root/epel-release-6-8.noarch.rpm yum groupinstall "High Availability" -y
ricci şifresini verelim
passwd ricci
Cluster servisleri başlangıçta çalışsın
chkconfig cman on chkconfig rgmanager on chkconfig modclusterd on chkconfig ricci on
Şimdi paket kurmakla işimiz bitti.
hosts dosyasına cluster üyelerini ve cluster ip’lerini ekleyelim
vi /etc/hosts 10.1.21.101 node1 10.1.21.102 node2 10.1.21.103 node3 10.1.21.99 cluster1 10.1.21.98 cluster2
statik ip verelim
vi /etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=static IPADDR=10.1.21.101 NETMASK=255.255.255.0 GATEWAY=10.1.21.254
Bütün nodlarda aynı cluster.conf olmalı. cluster.conf her değiştirildiğinde config_version=”n” arttırılmalıdır.
vi /etc/cluster/cluster.conf <?xml version="1.0"?> <cluster config_version="16" name="hacluster"> <clusternodes> <clusternode name="deneme1" nodeid="1" votes="1"> <fence> <method name="single"/> </fence> </clusternode> <clusternode name="deneme2" nodeid="2" votes="1"> <fence> <method name="single"/> </fence> </clusternode> <clusternode name="deneme3" nodeid="3" votes="1"> <fence> <method name="single"/> </fence> </clusternode> <clusternode name="deneme4" nodeid="4" votes="1"> <fence> <method name="single"/> </fence> </clusternode> </clusternodes> <fencedevices/> <rm> <failoverdomains> <failoverdomain name="first" ordered="1" restricted="0"> <failoverdomainnode name="deneme1" priority="4"/> <failoverdomainnode name="deneme2" priority="3"/> <failoverdomainnode name="deneme3" priority="2"/> <failoverdomainnode name="deneme4" priority="1"/> </failoverdomain> </failoverdomains> <resources> <ip address="10.1.21.200" monitor_link="1"/> <ip address="10.1.21.201" monitor_link="1"/> <ip address="10.1.21.202" monitor_link="1"/> </resources> <service autostart="1" exclusive="1" name="IP" recovery="relocate"> <ip ref="10.1.21.200"/> </service> <service autostart="1" exclusive="1" name="IP2" recovery="relocate"> <ip ref="10.1.21.201"/> </service> <service autostart="1" exclusive="1" name="IP3" recovery="relocate"> <ip ref="10.1.21.202"/> </service> </rm> </cluster>
Bütün nodlarda konfigürasyon validasyonu için
ccs_config_validate
Tebrikler. Clusterımız hazır ve nazır…
Hadi biraz eğlenelim
Cluster üyelerini görmek için
cman_tool nodes Node Sts Inc Joined Name 1 M 632 2011-09-16 06:26:53 hn1.redhat.com 2 M 636 2011-09-16 06:26:53 hn2.redhat.com
Sanal ipleri görmek için
#ip addr list -- Get the virtual Ip Address ------------------------------------------------------ 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 08:00:27:06:76:c7 brd ff:ff:ff:ff:ff:ff inet 151.8.18.53/16 brd 151.8.255.255 scope global eth0 inet 151.8.18.55/16 scope global secondary eth0 inet6 fe80::a00:27ff:fe06:76c7/64 scope link
veya
ip addr list| grep "global second"| cut -d" " -f6| cut -d/ -f1
Cluster durumunu görmek için
# clustat -l Cluster Status for Test_cluster @ Fri Sep 16 06:44:36 2011 Member Status: Quorate Member Name ID Status ------ ---- ---- ------ hn1.redhat.com 1 Online, Local, rgmanager hn2.redhat.com 2 Online, rgmanager Service Information ------- ----------- Service Name : service:File system Mounting Current State : started (112) Flags : none (0) Owner : hn2.redhat.com Last Owner : hn1.redhat.com Last Transition : Fri Sep 16 06:19:27 2011 Service Name : service:IP Address Current State : started (112) Flags : none (0) Owner : hn1.redhat.com Last Owner : hn2.redhat.com Last Transition : Fri Sep 16 06:27:18 2011
Servisi bir üyeden diğerine taşımak için
#clusvcadm -r service-name -m host-name clusvcadm -r "IP" -m deneme1
HA Troubleshooting
At least that’s the theory. You may experience some issues, and when you do, you’ll find that troubleshooting HA clusters is a complex task because of the way they work – various daemons and kernel modules are responsible for different HA tasks, and each of these essential parts of the cluster can cause problems.
Checking logs can provide some clues when things go wrong. By default, all cluster-related messages go to /var/log/messages. These simple messages give basic information about major changes in the cluster, such as starting, stopping, or moving a service. This log also collects errors about problems with cluster communication.
You can find additional logs in the directory /var/log/cluster/. Each of the cluster’s components has a log file; the most important ones are:
corosync.log, which provides information about intercluster communication and synchronization. You can also use the command corosync-objctl without any arguments to show the cluster’s configuration in full detail.
rgmanager.log, which lists information related to the cluster’s services.
fenced.log, which provides information about fencing nodes. This log is not very detailed by default. It’s better to use the command fence_tool dump when debugging fenced daemon problems.
Boot Loader’a password koymak: Kernel’i koru!
Haziran 17, 2013 § Yorum yok § Kalıcı bağlantı
Bootloader’a password koyalım. Millet kernel’a parametre veremesin!
grub-md5-crypt
Bu komutun çıktısını /etc/grub.conf dosyasının içine aşağıdaki satırla yazalım.
password --md5 $1$t8JvC1$8buXiBsfANd79/X3elp9G1
Şimdi GRUB menüsünde ‘p’ tuşuna basarak edit moduna geçilebilir.
O aşamada ise password girilmesi gerekmektedir.
Bu password korumasını kaldırmak için kurulum CD/DVD’si takılıyken ‘Rescue Installed System’ menüsüne girilerek
chroot /mnt/sysimage vi /etc/grub.conf ('password' satırını kaldır) reboot
yapılabilir. Aynı işlem Herhangi bir Live CD ile de yapılabilir.
Live CD saldırısını engellemek için
-BİOS şifresi koy
-BİOS’da boot sırasını önce HDD sonra CD/DVD olarak değiştir.
Linux’ü Hack etmek: Single User Mode olmadan!
Haziran 17, 2013 § Yorum yok § Kalıcı bağlantı
Single user mode kullanımındaki gibi grub menüsünden kernel satırı edit edilir.
kernel satırının sonuna ‘ init=/bin/bash’ yazılır.
Bilgisayar açıldıktan sonra ‘passwd’ işe yaramayacak.
Bunun sebebi kökün (/) read only mount olması.
Bu sorunu çözmek için kökü remount edelim.
mount -o remount,rw /
Şimdi ‘passwd’ çalışmalı.
Linux’ü Hack etmek: Single User Mode!
Haziran 17, 2013 § Yorum yok § Kalıcı bağlantı
1. Yol:
– kernel satırına gelinir ve ‘e’ tuşu ile edit edilir
-kernel satırının sonuna ‘ 1’ konulur ve boot için ‘b’ tuşuna basılır
Şimdi bilgisayar single user modda açıldı.
‘passwd’ ile root password değiştirilebilir.
Eğer ‘passwd’ de bir sorun olursa SELinux açık demektir.
Önce ‘setenforce 0’ sonra ‘passwd’ kullanılabilir.
Linux konuşuyor?
Haziran 7, 2013 § Yorum yok § Kalıcı bağlantı
echo 'you are a loser' | festival --tts for count in $(seq 1 10) ; do espeak "Go Away" ; done