Friday, March 25, 2016

Belirli bir Portu/Dosyayı Kullanan Prosesleri Nasıl Bulurum?

Bazen belirli bir portun hangi proses tarafından kullanıldığını bilmek isteriz. Sorunun yanıtı için Linux işletim sisteminde lsof komutundan yararlanırız:
[oracle@host02 ~]$ lsof -i  tcp:8080
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    20036 oracle  286u  IPv4  83463      0t0  TCP localhost.localdomain:webcache (LISTEN)
Portları kullanan tüm uygulamaların listesini almak için aynı komutu bu kez port numarası vermeden çalıştırıyoruz:
[oracle@host02 ~]$ lsof -i tcp
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
jstatd      318 oracle   13u  IPv6 138832      0t0  TCP *:44372 (LISTEN)
jstatd      318 oracle   14u  IPv6 138834      0t0  TCP *:vcom-tunnel (LISTEN)
clock-app  2936 oracle   21u  IPv4 202838      0t0  TCP host02.example.com:52606->194.215.113.148.static.turktelekom.com.tr:http (ESTABLISHED)
java      19953 oracle   27u  IPv4  83358      0t0  TCP localhost.localdomain:53522 (LISTEN)
java      19953 oracle   35u  IPv4  87094      0t0  TCP localhost.localdomain:53522->localhost.localdomain:51083 (ESTABLISHED)
java      19970 oracle   85u  IPv4  85964      0t0  TCP localhost.localdomain:51083->localhost.localdomain:53522 (ESTABLISHED)
java      19970 oracle   93u  IPv4  85965      0t0  TCP localhost.localdomain:distinct (LISTEN)
java      19970 oracle   94u  IPv4  85966      0t0  TCP localhost.localdomain:osm-appsrvr (LISTEN)
java      19970 oracle  230u  IPv4  83412      0t0  TCP localhost.localdomain:distinct->localhost.localdomain:54740 (ESTABLISHED)
java      19970 oracle  236u  IPv4  87123      0t0  TCP localhost.localdomain:distinct->localhost.localdomain:46059 (ESTABLISHED)
java      20036 oracle   93u  IPv4  87107      0t0  TCP localhost.localdomain:54740->localhost.localdomain:distinct (ESTABLISHED)
java      20036 oracle  286u  IPv4  83463      0t0  TCP localhost.localdomain:webcache (LISTEN)
java      20036 oracle  296u  IPv4  83470      0t0  TCP localhost.localdomain:n1-rmgmt (LISTEN)
java      20036 oracle  298u  IPv4  83474      0t0  TCP localhost.localdomain:jboss-iiop (LISTEN)
java      20036 oracle  305u  IPv4  87124      0t0  TCP localhost.localdomain:apc-5455 (LISTEN)
java      20036 oracle  306u  IPv4  87125      0t0  TCP localhost.localdomain:5445 (LISTEN)
java      20082 oracle   93u  IPv4  85989      0t0  TCP localhost.localdomain:46059->localhost.localdomain:distinct (ESTABLISHED)
java      20082 oracle  290u  IPv4  84496      0t0  TCP localhost.localdomain:rexecj (LISTEN)
java      20082 oracle  291u  IPv4  83476      0t0  TCP localhost.localdomain:a21-an-1xbs (LISTEN)
java      20082 oracle  298u  IPv4  84498      0t0  TCP localhost.localdomain:ipr-dglt (LISTEN)
java      20082 oracle  305u  IPv4  83478      0t0  TCP localhost.localdomain:a4-sdunode (LISTEN)
java      20082 oracle  306u  IPv4  83479      0t0  TCP localhost.localdomain:5595 (LISTEN)
Şimdi domain modunda çalışan jboss sunucularının hangi portları kullandığını bulmaya çalışalım:
[oracle@host02 ~]$ pids=$(/opt/jdk1.8.0_74/bin/jps | grep jboss | gawk '{print $1}')
[oracle@host02 ~]$ for pid in $pids; do 
> lsof -a -p $pid -i4 | tail -n +2
> done
java    19953 oracle   27u  IPv4  83358      0t0  TCP localhost.localdomain:53522 (LISTEN)
java    19953 oracle   35u  IPv4  87094      0t0  TCP localhost.localdomain:53522->localhost.localdomain:51083 (ESTABLISHED)
java    19970 oracle   85u  IPv4  85964      0t0  TCP localhost.localdomain:51083->localhost.localdomain:53522 (ESTABLISHED)
java    19970 oracle   93u  IPv4  85965      0t0  TCP localhost.localdomain:distinct (LISTEN)
java    19970 oracle   94u  IPv4  85966      0t0  TCP localhost.localdomain:osm-appsrvr (LISTEN)
java    19970 oracle  230u  IPv4  83412      0t0  TCP localhost.localdomain:distinct->localhost.localdomain:54740 (ESTABLISHED)
java    19970 oracle  236u  IPv4  87123      0t0  TCP localhost.localdomain:distinct->localhost.localdomain:46059 (ESTABLISHED)
java    20082 oracle   93u  IPv4  85989      0t0  TCP localhost.localdomain:46059->localhost.localdomain:distinct (ESTABLISHED)
java    20082 oracle  290u  IPv4  84496      0t0  TCP localhost.localdomain:rexecj (LISTEN)
java    20082 oracle  291u  IPv4  83476      0t0  TCP localhost.localdomain:a21-an-1xbs (LISTEN)
java    20082 oracle  298u  IPv4  84498      0t0  TCP localhost.localdomain:ipr-dglt (LISTEN)
java    20082 oracle  305u  IPv4  83478      0t0  TCP localhost.localdomain:a4-sdunode (LISTEN)
java    20082 oracle  306u  IPv4  83479      0t0  TCP localhost.localdomain:5595 (LISTEN)
java    20036 oracle   93u  IPv4  87107      0t0  TCP localhost.localdomain:54740->localhost.localdomain:distinct (ESTABLISHED)
java    20036 oracle  286u  IPv4  83463      0t0  TCP localhost.localdomain:webcache (LISTEN)
java    20036 oracle  296u  IPv4  83470      0t0  TCP localhost.localdomain:n1-rmgmt (LISTEN)
java    20036 oracle  298u  IPv4  83474      0t0  TCP localhost.localdomain:jboss-iiop (LISTEN)
java    20036 oracle  305u  IPv4  87124      0t0  TCP localhost.localdomain:apc-5455 (LISTEN)
java    20036 oracle  306u  IPv4  87125      0t0  TCP localhost.localdomain:5445 (LISTEN)
İlk 1024 portun özel kullanımları bulunuyor: 80 http protokokü, 21 ftp protokolü ve 22 ssh protokolü için ayrılmıştır. Şimdi elimizdeki sistem için bu ilk 1024 portun hangileri açık ve hangi prosesler tarafından kullanılıyor bir göz atalım:
[oracle@host02 ~]$ sudo lsof -n -i tcp:ssh
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd     2037   root    3u  IPv4  11836      0t0  TCP *:ssh (LISTEN)
sshd     2037   root    4u  IPv6  11838      0t0  TCP *:ssh (LISTEN)
sshd    16560   root    3r  IPv4 211012      0t0  TCP 192.168.211.137:ssh->192.168.211.138:52789 (ESTABLISHED)
sshd    16562 oracle    3u  IPv4 211012      0t0  TCP 192.168.211.137:ssh->192.168.211.138:52789 (ESTABLISHED)
[oracle@host02 ~]$ sudo lsof -n -i tcp:http
COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clock-app 2936 oracle   21u  IPv4 206825      0t0  TCP 192.168.211.137:52620->195.175.112.178:http (CLOSE_WAIT)
[oracle@host02 ~]$ sudo lsof -n -i tcp:1-pop3
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd       2037   root    3u  IPv4  11836      0t0  TCP *:ssh (LISTEN)
sshd       2037   root    4u  IPv6  11838      0t0  TCP *:ssh (LISTEN)
clock-app  2936 oracle   21u  IPv4 206825      0t0  TCP 192.168.211.137:52620->195.175.112.178:http (CLOSE_WAIT)
sshd      16560   root    3r  IPv4 211012      0t0  TCP 192.168.211.137:ssh->192.168.211.138:52789 (ESTABLISHED)
sshd      16562 oracle    3u  IPv4 211012      0t0  TCP 192.168.211.137:ssh->192.168.211.138:52789 (ESTABLISHED)
Kullanımdaki portları netstat komutu ile de görebiliriz:
[oracle@host02 ~]$ sudo netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:5595              0.0.0.0:*                   LISTEN      20082/java          
tcp        0      0 127.0.0.1:3678              0.0.0.0:*                   LISTEN      20082/java          
tcp        0      0 127.0.0.1:4447              0.0.0.0:*                   LISTEN      20036/java          
tcp        0      0 127.0.0.1:5605              0.0.0.0:*                   LISTEN      20082/java          
tcp        0      0 127.0.0.1:5445              0.0.0.0:*                   LISTEN      20036/java          
tcp        0      0 127.0.0.1:8230              0.0.0.0:*                   LISTEN      20082/java          
tcp        0      0 127.0.0.1:9990              0.0.0.0:*                   LISTEN      19970/java          
tcp        0      0 0.0.0.0:35622               0.0.0.0:*                   LISTEN      1753/rpc.statd      
tcp        0      0 127.0.0.1:3528              0.0.0.0:*                   LISTEN      20036/java          
tcp        0      0 127.0.0.1:5455              0.0.0.0:*                   LISTEN      20036/java          
tcp        0      0 127.0.0.1:9999              0.0.0.0:*                   LISTEN      19970/java          
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1567/rpcbind        
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      20036/java          
tcp        0      0 127.0.0.1:53522             0.0.0.0:*                   LISTEN      19953/java          
tcp        0      0 127.0.0.1:4597              0.0.0.0:*                   LISTEN      20082/java          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2037/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1757/cupsd          
tcp        0      0 :::8001                     :::*                        LISTEN      318/jstatd          
tcp        0      0 :::3306                     :::*                        LISTEN      19189/mysqld        
tcp        0      0 :::111                      :::*                        LISTEN      1567/rpcbind        
tcp        0      0 :::44372                    :::*                        LISTEN      318/jstatd          
tcp        0      0 :::22                       :::*                        LISTEN      2037/sshd           
tcp        0      0 ::1:631                     :::*                        LISTEN      1757/cupsd          
tcp        0      0 :::34265                    :::*                        LISTEN      1753/rpc.statd      
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1757/cupsd          
udp        0      0 0.0.0.0:657                 0.0.0.0:*                               1753/rpc.statd      
udp        0      0 0.0.0.0:890                 0.0.0.0:*                               1567/rpcbind        
udp        0      0 0.0.0.0:52285               0.0.0.0:*                               1753/rpc.statd      
udp        0      0 0.0.0.0:33975               0.0.0.0:*                               1674/avahi-daemon   
udp        0      0 0.0.0.0:5353                0.0.0.0:*                               1674/avahi-daemon   
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               15038/dhclient      
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1567/rpcbind        
udp        0      0 :::890                      :::*                                    1567/rpcbind        
udp        0      0 :::60726                    :::*                                    1753/rpc.statd      
udp        0      0 :::111                      :::*                                    1567/rpcbind        
Aynı problemi Windows platformunda çözmeye çalışalım:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>netstat -bano

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       980
  RpcSs
 [svchost.exe]
  TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       4100
 [vmware-hostd.exe]
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
 Can not obtain ownership information
  TCP    0.0.0.0:554            0.0.0.0:0              LISTENING       7364
 [wmpnetwk.exe]
  TCP    0.0.0.0:902            0.0.0.0:0              LISTENING       2620
 [vmware-authd.exe]
  TCP    0.0.0.0:912            0.0.0.0:0              LISTENING       2620
 [vmware-authd.exe]
  TCP    0.0.0.0:1025           0.0.0.0:0              LISTENING       752
 [wininit.exe]
  TCP    0.0.0.0:1026           0.0.0.0:0              LISTENING       1168
  EventLog
 [svchost.exe]
  TCP    0.0.0.0:1027           0.0.0.0:0              LISTENING       1196
  Schedule
 [svchost.exe]
  TCP    0.0.0.0:1028           0.0.0.0:0              LISTENING       1968
 [spoolsv.exe]
  TCP    0.0.0.0:1030           0.0.0.0:0              LISTENING       820
 [lsass.exe]
  TCP    0.0.0.0:1036           0.0.0.0:0              LISTENING       812
 Can not obtain ownership information
  TCP    0.0.0.0:2869           0.0.0.0:0              LISTENING       4
 Can not obtain ownership information
  TCP    0.0.0.0:4537           0.0.0.0:0              LISTENING       4400
  PolicyAgent
 [svchost.exe]
  TCP    0.0.0.0:5357           0.0.0.0:0              LISTENING       4
 Can not obtain ownership information
  TCP    0.0.0.0:8443           0.0.0.0:0              LISTENING       2428
 [VisualSVNServer.exe]
  TCP    0.0.0.0:10243          0.0.0.0:0              LISTENING       4
 Can not obtain ownership information
  TCP    0.0.0.0:48359          0.0.0.0:0              LISTENING       13684
 [uTorrent.exe]
  TCP    127.0.0.1:443          127.0.0.1:15712        ESTABLISHED     4100
 [vmware-hostd.exe]
  TCP    127.0.0.1:443          127.0.0.1:55609        ESTABLISHED     4100
 [vmware-hostd.exe]
  TCP    127.0.0.1:1203         0.0.0.0:0              LISTENING       4896
 [Nimi Places.exe]
  TCP    127.0.0.1:1283         127.0.0.1:6543         ESTABLISHED     7964
 [BtTray.exe]
  TCP    127.0.0.1:1825         127.0.0.1:1826         ESTABLISHED     4100
 [vmware-hostd.exe]
  TCP    127.0.0.1:1826         127.0.0.1:1825         ESTABLISHED     4100
 [vmware-hostd.exe]
  TCP    127.0.0.1:6543         0.0.0.0:0              LISTENING       7972
 [BtvStack.exe]
  TCP    127.0.0.1:6543         127.0.0.1:1283         ESTABLISHED     7972
 [BtvStack.exe]
  TCP    127.0.0.1:6543         127.0.0.1:47635        ESTABLISHED     7972
 [BtvStack.exe]
  TCP    127.0.0.1:6543         127.0.0.1:55624        ESTABLISHED     7972
 [BtvStack.exe]
  TCP    127.0.0.1:6544         0.0.0.0:0              LISTENING       7964
 [BtTray.exe]
  TCP    127.0.0.1:8307         0.0.0.0:0              LISTENING       4100
 [vmware-hostd.exe]
  TCP    127.0.0.1:10000        0.0.0.0:0              LISTENING       13684
 [uTorrent.exe]
  TCP    127.0.0.1:15700        127.0.0.1:15701        ESTABLISHED     8368
 [vmware.exe]
  TCP    127.0.0.1:15701        127.0.0.1:15700        ESTABLISHED     8368
 [vmware.exe]
  TCP    127.0.0.1:15712        127.0.0.1:443          ESTABLISHED     8368
 [vmware.exe]
  TCP    127.0.0.1:27275        0.0.0.0:0              LISTENING       1780
 [AvastSvc.exe]
  TCP    127.0.0.1:47635        127.0.0.1:6543         ESTABLISHED     11744
 [TOTALCMD64.EXE]
  TCP    127.0.0.1:50911        0.0.0.0:0              LISTENING       7372
 [ss_conn_service.exe]
  TCP    127.0.0.1:55609        127.0.0.1:443          ESTABLISHED     8368
 [vmware.exe]
  TCP    127.0.0.1:55624        127.0.0.1:6543         ESTABLISHED     760
 [explorer.exe]
  TCP    127.0.0.1:60943        127.0.0.1:60944        ESTABLISHED     2620
 [vmware-authd.exe]
  TCP    127.0.0.1:60944        127.0.0.1:60943        ESTABLISHED     2620
 [vmware-authd.exe]
  TCP    127.0.0.1:60947        127.0.0.1:60948        ESTABLISHED     2620
 [vmware-authd.exe]
  TCP    127.0.0.1:60948        127.0.0.1:60947        ESTABLISHED     2620

 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

C:\WINDOWS\system32>
Şimdi Linux işletim sisteminde, mysqld prosesi tarafından kullanılan dosyaların listesini alalım:
[oracle@host02 ~]$ pgrep mysqld
18991
19189
[oracle@host02 ~]$ sudo lsof -a -p 18991 -p 19189
COMMAND     PID  USER   FD   TYPE             DEVICE  SIZE/OFF    NODE NAME
mysqld_sa 18991  root  cwd    DIR              252,0      4096       2 /
mysqld_sa 18991  root  rtd    DIR              252,0      4096       2 /
mysqld_sa 18991  root  txt    REG              252,0    938736 7077963 /bin/bash
mysqld_sa 18991  root  mem    REG              252,0    156872 4456862 /lib64/ld-2.12.so
mysqld_sa 18991  root  mem    REG              252,0     22536 4456871 /lib64/libdl-2.12.so
mysqld_sa 18991  root  mem    REG              252,0   1918016 4456863 /lib64/libc-2.12.so
mysqld_sa 18991  root  mem    REG              252,0    138280 4456907 /lib64/libtinfo.so.5.7
mysqld_sa 18991  root  mem    REG              252,0     65928 4456478 /lib64/libnss_files-2.12.so
mysqld_sa 18991  root  mem    REG              252,0  99158576  262845 /usr/lib/locale/locale-archive
mysqld_sa 18991  root  mem    REG              252,0     26060  526936 /usr/lib64/gconv/gconv-modules.cache
mysqld_sa 18991  root    0r   CHR                1,3       0t0    4059 /dev/null
mysqld_sa 18991  root    1w   CHR                1,3       0t0    4059 /dev/null
mysqld_sa 18991  root    2w   CHR                1,3       0t0    4059 /dev/null
mysqld_sa 18991  root  255r   REG              252,0     26190  263522 /usr/bin/mysqld_safe
mysqld    19189 mysql  cwd    DIR              252,0      4096 3146699 /var/lib/mysql
mysqld    19189 mysql  rtd    DIR              252,0      4096       2 /
mysqld    19189 mysql  txt    REG              252,0 247743467  263323 /usr/sbin/mysqld
mysqld    19189 mysql  mem    REG              252,0      5624 4456450 /lib64/libaio.so.1.0.1
mysqld    19189 mysql  mem    REG              252,0    156872 4456862 /lib64/ld-2.12.so
mysqld    19189 mysql  mem    REG              252,0     22536 4456871 /lib64/libdl-2.12.so
mysqld    19189 mysql  mem    REG              252,0   1918016 4456863 /lib64/libc-2.12.so
mysqld    19189 mysql  mem    REG              252,0    145720 4456865 /lib64/libpthread-2.12.so
mysqld    19189 mysql  mem    REG              252,0     47064 4456866 /lib64/librt-2.12.so
mysqld    19189 mysql  mem    REG              252,0    598800 4456868 /lib64/libm-2.12.so
mysqld    19189 mysql  mem    REG              252,0     38872  267401 /usr/lib64/libnuma.so.1
mysqld    19189 mysql  mem    REG              252,0     93224 4456879 /lib64/libgcc_s-4.4.6-20120305.so.1
mysqld    19189 mysql  mem    REG              252,0    989840  264009 /usr/lib64/libstdc++.so.6.0.13
mysqld    19189 mysql  mem    REG              252,0     43392 4456882 /lib64/libcrypt-2.12.so
mysqld    19189 mysql  mem    REG              252,0    386040 4456881 /lib64/libfreebl3.so
mysqld    19189 mysql  mem    REG              252,0    211304 1445125 /usr/lib64/mysql/plugin/validate_password.so
mysqld    19189 mysql  mem    REG              252,0    436068 1445115 /usr/lib64/mysql/plugin/keyring_file.so
mysqld    19189 mysql  mem    REG              252,0     65928 4456478 /lib64/libnss_files-2.12.so
mysqld    19189 mysql    0r   CHR                1,3       0t0    4059 /dev/null
mysqld    19189 mysql    1w   REG              252,0     64693 2885316 /var/log/mysqld.log
mysqld    19189 mysql    2w   REG              252,0     64693 2885316 /var/log/mysqld.log
mysqld    19189 mysql    3uW  REG              252,0  79691776 3146720 /var/lib/mysql/ibdata1
mysqld    19189 mysql    4u   REG              252,0         0 1185770 /tmp/ib0rYjnE (deleted)
mysqld    19189 mysql    5u   REG              252,0         0 1185772 /tmp/ibx0NOve (deleted)
mysqld    19189 mysql    6u   REG              252,0         0 1185773 /tmp/ib8BLjEO (deleted)
mysqld    19189 mysql    7u   REG              252,0         0 1185774 /tmp/ibUbHe0Z (deleted)
mysqld    19189 mysql    8uW  REG              252,0  50331648 3146721 /var/lib/mysql/ib_logfile0
mysqld    19189 mysql    9uW  REG              252,0  50331648 3146722 /var/lib/mysql/ib_logfile1
mysqld    19189 mysql   10uW  REG              252,0  12582912 3146690 /var/lib/mysql/ibtmp1
mysqld    19189 mysql   11u   REG              252,0         0 1185775 /tmp/ibvI1vvB (deleted)
mysqld    19189 mysql   12uW  REG              252,0     98304 3146737 /var/lib/mysql/mysql/plugin.ibd
mysqld    19189 mysql   13uW  REG              252,0     98304 3146785 /var/lib/mysql/mysql/innodb_index_stats.ibd
mysqld    19189 mysql   14uW  REG              252,0     98304 3146755 /var/lib/mysql/mysql/time_zone_name.ibd
mysqld    19189 mysql   15uW  REG              252,0     98304 3146783 /var/lib/mysql/mysql/innodb_table_stats.ibd
mysqld    19189 mysql   16uW  REG              252,0     98304 3146759 /var/lib/mysql/mysql/time_zone_transition.ibd
mysqld    19189 mysql   17uW  REG              252,0   9437184 3147013 /var/lib/mysql/mylog/log_table.ibd
mysqld    19189 mysql   18uW  REG              252,0     98304 3146761 /var/lib/mysql/mysql/time_zone_transition_type.ibd
mysqld    19189 mysql   19uW  REG              252,0     98304 3146763 /var/lib/mysql/mysql/time_zone_leap_second.ibd
mysqld    19189 mysql   20uW  REG              252,0     98304 3146793 /var/lib/mysql/mysql/gtid_executed.ibd
mysqld    19189 mysql   21uW  REG              252,0     98304 3146795 /var/lib/mysql/mysql/server_cost.ibd
mysqld    19189 mysql   22r   CHR                1,9       0t0    4064 /dev/urandom
mysqld    19189 mysql   23uW  REG              252,0     98304 3146797 /var/lib/mysql/mysql/engine_cost.ibd
mysqld    19189 mysql   24uW  REG              252,0    196608 3147016 /var/lib/mysql/moviedb/directors.ibd
mysqld    19189 mysql   25u  IPv6              86509       0t0     TCP *:mysql (LISTEN)
mysqld    19189 mysql   26u  unix 0xffff880135c75400       0t0   85061 /var/lib/mysql/mysql.sock
mysqld    19189 mysql   27uW  REG              252,0    131072 3147018 /var/lib/mysql/moviedb/dvdmovies.ibd
mysqld    19189 mysql   28uW  REG              252,0    114688 3147020 /var/lib/mysql/moviedb/dvds.ibd
mysqld    19189 mysql   29uW  REG              252,0    114688 3147022 /var/lib/mysql/moviedb/genres.ibd
mysqld    19189 mysql   30u   REG              252,0      4096 3146731 /var/lib/mysql/mysql/user.MYI
mysqld    19189 mysql   31uW  REG              252,0     98304 3147024 /var/lib/mysql/moviedb/moviedirectors.ibd
mysqld    19189 mysql   32u   REG              252,0       368 3146732 /var/lib/mysql/mysql/user.MYD
mysqld    19189 mysql   33u   REG              252,0      5120 3146728 /var/lib/mysql/mysql/db.MYI
mysqld    19189 mysql   34uW  REG              252,0    131072 3147026 /var/lib/mysql/moviedb/moviegenres.ibd
mysqld    19189 mysql   35u   REG              252,0       488 3146729 /var/lib/mysql/mysql/db.MYD
mysqld    19189 mysql   36u   REG              252,0      8192 3146888 /var/lib/mysql/mysql/proxies_priv.MYI
mysqld    19189 mysql   37uW  REG              252,0    212992 3147028 /var/lib/mysql/moviedb/movies.ibd
mysqld    19189 mysql   38u   REG              252,0       789 3146889 /var/lib/mysql/mysql/proxies_priv.MYD
mysqld    19189 mysql   39uW  REG              252,0    114688 3147030 /var/lib/mysql/moviedb/users.ibd
mysqld    19189 mysql   40uW  REG              252,0     98304 3147035 /var/lib/mysql/userdb/USERS.ibd
mysqld    19189 mysql   41uW  REG              252,0     98304 3146757 /var/lib/mysql/mysql/time_zone.ibd
mysqld    19189 mysql   42uW  REG              252,0     98304 3147037 /var/lib/mysql/userdb/USER_ROLES.ibd
mysqld    19189 mysql   43u   REG              252,0      8192 3146741 /var/lib/mysql/mysql/tables_priv.MYI
mysqld    19189 mysql   44u   REG              252,0       899 3146742 /var/lib/mysql/mysql/tables_priv.MYD
mysqld    19189 mysql   45u   REG              252,0      4096 3146744 /var/lib/mysql/mysql/columns_priv.MYI
mysqld    19189 mysql   46u   REG              252,0         0 3146745 /var/lib/mysql/mysql/columns_priv.MYD
mysqld    19189 mysql   47u   REG              252,0      4096 3146768 /var/lib/mysql/mysql/procs_priv.MYI
mysqld    19189 mysql   48u   REG              252,0         0 3146769 /var/lib/mysql/mysql/procs_priv.MYD
mysqld    19189 mysql   49uW  REG              252,0     98304 3146739 /var/lib/mysql/mysql/servers.ibd
mysqld    19189 mysql   50u   REG              252,0      2048 3146777 /var/lib/mysql/mysql/event.MYI
mysqld    19189 mysql   51u   REG              252,0         0 3146778 /var/lib/mysql/mysql/event.MYD
mysqld    19189 mysql   52u  IPv6             212670       0t0     TCP host02.example.com:mysql->host01.example.com:36427 (ESTABLISHED)
mysqld    19189 mysql   53u  IPv6             212671       0t0     TCP host02.example.com:mysql->host01.example.com:36428 (ESTABLISHED)
mysqld    19189 mysql   54u  IPv6             212672       0t0     TCP host02.example.com:mysql->host01.example.com:36429 (ESTABLISHED)
mysqld    19189 mysql   55u  IPv6             212673       0t0     TCP host02.example.com:mysql->host01.example.com:36430 (ESTABLISHED)
mysqld    19189 mysql   58r   CHR                1,9       0t0    4064 /dev/urandom



Peki, aynı problemi Windows'da nasıl çözeriz? Çözüm için ilk olarak bu bağlantıdan bir dizi araç içeren bir yazılım indirmeniz gerekecektir: Sysinternals Suite. Bu yazılım içinde handle.exe aracını kullanarak sistemde açık olan tüm dosyaların ve dosyaya sahip olan proseslerin listesini alabilirsiniz:
c:\opt\sysinternals>handle.exe

Handle v4.0
Copyright (C) 1997-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

------------------------------------------------------------------------------
System pid: 4 \<unable to open process>
   4C: File  (R--)   C:\ProgramData\AVAST Software\Avast\ng\NgBase\Snapshots\snapshot_{5b38543c-a0c7-42ec-a836-35e63a4ae
88c}.dat
   54: File  (RWD)   \clfs
   5C: File  (R--)   C:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000012
   60: File  (R--)   C:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000002
   E0: File  (RW-)   \clfs
  11C: File  (RWD)   \clfs
  128: File  (RWD)   \clfs
  148: File  (R-D)   C:\Windows\System32\wdi\LogFiles\WdiContextLog.etl.001
  1A4: File  (RWD)   \clfs
  1C4: File  (R--)   C:\$Extend\$RmMetadata\$TxfLog\$TxfLog.blf
  1C8: File  (RWD)   C:\$Extend\$RmMetadata\$Txf
  1D0: File  (RWD)   \clfs
  1D8: File  (RWD)   \clfs
  1E0: File  (RW-)   \clfs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
mysqld tarafından kullanılan dosyaların listesine basit bir şekilde ulaşabilirsiniz: handle -p mysqld
c:\opt\sysinternals>handle -p mysqld

Handle v4.0
Copyright (C) 1997-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

------------------------------------------------------------------------------
mysqld.exe pid: 2376 GODEL42\jack
    8: File  (RWD)   C:\Users\jack\AppData\Local\Temp\ibDA8D.tmp
  1B0: File  (RW-)   C:\opt64\mysql-5.6.10\data
  1B8: File  (RWD)   C:\Users\jack\AppData\Local\Temp\ibDA8E.tmp
  1BC: File  (RWD)   C:\Users\jack\AppData\Local\Temp\ibDA8F.tmp
  858: File  (RWD)   C:\Users\jack\AppData\Local\Temp\ibDAA0.tmp
  888: File  (R--)   C:\opt64\mysql-5.6.10\data\ibdata1
  88C: File  (R--)   C:\opt64\mysql-5.6.10\data\ib_logfile0
  890: File  (R--)   C:\opt64\mysql-5.6.10\data\ib_logfile1
  894: File  (R--)   C:\opt64\mysql-5.6.10\data\mysql\innodb_index_stats.ibd
  898: File  (R--)   C:\opt64\mysql-5.6.10\data\world_innodb\country.ibd
  8A0: File  (R--)   C:\opt64\mysql-5.6.10\data\world_innodb\countrylanguage.ibd
  8A4: File  (R--)   C:\opt64\mysql-5.6.10\data\mysql\innodb_table_stats.ibd
  8AC: File  (RWD)   C:\Users\jack\AppData\Local\Temp\ibDE79.tmp
  8BC: File  (R--)   C:\opt64\mysql-5.6.10\data\userdb\user_roles.ibd
  8C0: File  (R--)   C:\opt64\mysql-5.6.10\data\test\tt.ibd
  8D4: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\procs_priv.MYI
  8DC: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\procs_priv.MYD
  8E0: Section       \...\ASqmManifestVersion
  8EC: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\user.MYI
  8F0: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\user.MYD
  8F4: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\db.MYI
  8F8: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\db.MYD
  8FC: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\proxies_priv.MYI
  900: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\proxies_priv.MYD
  904: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\tables_priv.MYD
  908: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\tables_priv.MYI
  90C: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\columns_priv.MYD
  910: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\columns_priv.MYI
  914: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\servers.MYD
  918: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\servers.MYI
  920: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\event.MYI
  930: File  (RWD)   C:\opt64\mysql-5.6.10\data\mysql\event.MYD
Linux işletim sisteminde /var/log dizini altında açık olan dosyaları ve bu dosyaları hangi prosese ait olduklarını bulmak istiyoruz:
[oracle@host02 ~]$ sudo lsof +D /var/log
COMMAND     PID  USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
auditd     1290  root    5w   REG  252,0  1026278 2884492 /var/log/audit/audit.log
rsyslogd   1394  root    1w   REG  252,0   291392 2885346 /var/log/messages
rsyslogd   1394  root    2w   REG  252,0    47234 2885260 /var/log/cron
rsyslogd   1394  root    4w   REG  252,0     6222 2885347 /var/log/secure
wpa_suppl  1717  root    3w   REG  252,0        0 2884385 /var/log/wpa_supplicant.log
mcelog     2025  root    3w   REG  252,0        0 2884412 /var/log/mcelog
abrt-dump  2363  root    4r   REG  252,0   291392 2885346 /var/log/messages
gdm-simpl  2448  root    1w   REG  252,0       99 2884503 /var/log/gdm/:0-slave.log
gdm-simpl  2448  root    2w   REG  252,0       99 2884503 /var/log/gdm/:0-slave.log
Xorg       2450  root    0w   REG  252,0    46800 2884505 /var/log/Xorg.0.log
Xorg       2450  root    2w   REG  252,0    34457 2884504 /var/log/gdm/:0.log
console-k  2465  root    9w   REG  252,0    19432 2884462 /var/log/ConsoleKit/history
gdm-sessi  2596  root    1w   REG  252,0       99 2884503 /var/log/gdm/:0-slave.log
gdm-sessi  2596  root    2w   REG  252,0       99 2884503 /var/log/gdm/:0-slave.log
mysqld    19189 mysql    1w   REG  252,0    64693 2885316 /var/log/mysqld.log
mysqld    19189 mysql    2w   REG  252,0    64693 2885316 /var/log/mysqld.log
Aynı problemi bu kez Windows platformunda c:\opt64\mysql-5.6.10 dizini için cevaplayalım:
c:\opt\sysinternals>handle c:\opt64\mysql-5.6.10

Handle v4.0
Copyright (C) 1997-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

cmd.exe            pid: 13272  type: File            74: C:\opt64\mysql-5.6.10\bin
mysqld.exe         pid: 2376   type: File           1B0: C:\opt64\mysql-5.6.10\data
mysqld.exe         pid: 2376   type: File           888: C:\opt64\mysql-5.6.10\data\ibdata1
mysqld.exe         pid: 2376   type: File           88C: C:\opt64\mysql-5.6.10\data\ib_logfile0
mysqld.exe         pid: 2376   type: File           890: C:\opt64\mysql-5.6.10\data\ib_logfile1
mysqld.exe         pid: 2376   type: File           894: C:\opt64\mysql-5.6.10\data\mysql\innodb_index_stats.ibd
mysqld.exe         pid: 2376   type: File           898: C:\opt64\mysql-5.6.10\data\world_innodb\country.ibd
mysqld.exe         pid: 2376   type: File           8A0: C:\opt64\mysql-5.6.10\data\world_innodb\countrylanguage.ibd
mysqld.exe         pid: 2376   type: File           8A4: C:\opt64\mysql-5.6.10\data\mysql\innodb_table_stats.ibd
mysqld.exe         pid: 2376   type: File           8BC: C:\opt64\mysql-5.6.10\data\userdb\user_roles.ibd
mysqld.exe         pid: 2376   type: File           8C0: C:\opt64\mysql-5.6.10\data\test\tt.ibd
mysqld.exe         pid: 2376   type: File           8D4: C:\opt64\mysql-5.6.10\data\mysql\procs_priv.MYI
mysqld.exe         pid: 2376   type: File           8DC: C:\opt64\mysql-5.6.10\data\mysql\procs_priv.MYD
mysqld.exe         pid: 2376   type: File           8EC: C:\opt64\mysql-5.6.10\data\mysql\user.MYI
mysqld.exe         pid: 2376   type: File           8F0: C:\opt64\mysql-5.6.10\data\mysql\user.MYD
mysqld.exe         pid: 2376   type: File           8F4: C:\opt64\mysql-5.6.10\data\mysql\db.MYI
mysqld.exe         pid: 2376   type: File           8F8: C:\opt64\mysql-5.6.10\data\mysql\db.MYD
mysqld.exe         pid: 2376   type: File           8FC: C:\opt64\mysql-5.6.10\data\mysql\proxies_priv.MYI
mysqld.exe         pid: 2376   type: File           900: C:\opt64\mysql-5.6.10\data\mysql\proxies_priv.MYD
mysqld.exe         pid: 2376   type: File           904: C:\opt64\mysql-5.6.10\data\mysql\tables_priv.MYD
mysqld.exe         pid: 2376   type: File           908: C:\opt64\mysql-5.6.10\data\mysql\tables_priv.MYI
mysqld.exe         pid: 2376   type: File           90C: C:\opt64\mysql-5.6.10\data\mysql\columns_priv.MYD
mysqld.exe         pid: 2376   type: File           910: C:\opt64\mysql-5.6.10\data\mysql\columns_priv.MYI
mysqld.exe         pid: 2376   type: File           914: C:\opt64\mysql-5.6.10\data\mysql\servers.MYD
mysqld.exe         pid: 2376   type: File           918: C:\opt64\mysql-5.6.10\data\mysql\servers.MYI
mysqld.exe         pid: 2376   type: File           920: C:\opt64\mysql-5.6.10\data\mysql\event.MYI
mysqld.exe         pid: 2376   type: File           930: C:\opt64\mysql-5.6.10\data\mysql\event.MYD

No comments:

Post a Comment