CentOS/ScientificLinux6でMyNETSを動かす

■CentOS/ScientificLinux6でMyNETSを動かす

ということで、試行錯誤してなんとか動かせたのでメモっておきます。

使ったのはScientificLinux6.7です。
標準ではphp5.3.3、mysql5.1.6ですが、不具合の問題で以下の対応をしました。

・全文検索用にmroongaを使う都合でoracle版mysql5.6導入
・MyNETSで日記投稿時エラーのためphpをius版5.3.29導入

■mroonga&oracle版mysqlインストール

$ yum install -y http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
$vi /etc/yum/yum.repos.d/groonga.repo
以下修正
/centos/$releasever/ → /centos/6/
$ yum install -y http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
$ yum makecache
$ yum install -y mysql-community-server
$ /sbin/service mysqld start
$ yum install -y mysql-community-mroonga
$ yum install -y groonga-tokenizer-mecab

$mysql -uroot
mysql> show engines;
mroongaを確認

# vi /etc/my.cnf
互換性のため以下を追記
character-set-server = utf8
skip-host-cache
skip-name-resolve
sql_mode=”
old_passwords=0

以下の設定はエラーになるので廃止
default-character-set=
table_cache=
log-slow-querie=
log=

■ius版php導入

# vi /etc/yum.repos.d/ius.repo
以下の内容で作成
[ius]
name=IUS Community Packages for Enterprise Linux 6 – $basearch
baseurl=http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/$basearch
#mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

# cd /etc/pki/rpm-gpg/
# wget http://dl.iuscommunity.org/pub/ius/IUS-COMMUNITY-GPG-KEY

# yum update
# yum install yum-plugin-replace
# yum replace php –replace-with php53u

# vi /etc/php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

■全文検索用データ修正
mysqlのダンプデータを以下のように書き換え

 FULLTEXT KEY `fullindex` (`body`) /*!50100 WITH PARSER `mecab` */
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
 ↓
 FULLTEXT INDEX (`body`)
) ENGINE=mroonga AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;

たぶん、これでOK

, , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■侵入改竄検知システム AIDE を使うメモ
 長くIDSとしてOsirisを使ってきたが時勢に合わなくなってしまったので、CentOS/ScientificLinuxに標準装備されているAIDEを使ってみたメモ。

■インストールと簡単な使い方

  1. # yum install aide
  2.  
  3. 設定編集(コメント充実)
  4. # vi /etc/aide.conf
  5. R = p+l+i+n+u+g+s+m+acl+selinux+xattrs+md5
  6.  
  7. 初期化
  8. # aide -i
  9.  
  10. 比較用DB作成
  11. # cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
  12.  
  13. 比較
  14. # aide -C
  15.  
  16. 通常用途
  17. # aide -u

■CentOS5系でselinuxで問題が出るケースの設定変更例

  1. # vi /etc/aide.conf
  2.  
  3. R = p+l+i+n+u+g+s+m+acl+xattrs+md5
  4. L = p+l+i+n+u+g+acl+xattrs
  5. > = p+l+u+g+i+n+S+acl+xattrs
  6.  
  7. DIR = p+l+i+n+u+g+acl+xattrs
  8.  
  9. PERMS = p+l+i+u+g+acl
  10.  
  11. DATAONLY =  p+l+n+u+g+s+acl+xattrs+md5+sha256+rmd160+tiger

■Prelink関連のエラーが出る場合の設定変更例

  1. # sed -i '/^PRELINKING=yes$/s/yes/no/' /etc/sysconfig/prelink
  2. # /usr/sbin/prelink -ua

■cron用script例

  1. # vi /root/script/aide.sh
  2. #!/bin/bash
  3.  
  4. /usr/sbin/aide -u
  5. /bin/cp -fr /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

■MyNETS用改竄検知設定例(/var/www/sns/wwwをSNS rootとする)

  1. # vi /etc/aide.conf
  2. # MyNETS SNS DIR
  3. /var/www/sns/www NORMAL
  4. !/var/www/sns/www/img
  5. !/var/www/sns/www/var

■参考リンク
http://pooh.gr.jp/?p=9633
http://blog.cecily.jp/kotou/51/
http://aikotobaha.blogspot.jp/2011/11/rhel-aide.html

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CentOS6/ScientificLinux6にmroongaを導入する
 CentOS6/ScientificLinux6にはmysql5.1.xが導入されていて、日本語全文検索にtritonnが利用できないので、後継プロジェクトになっているmroongaを導入し、日本語全文検索を可能にする。実際の手順はほぼmroongaの公式HPの通り。

 mroonga
 http://mroonga.github.io/ja/

■インストール(mysqlは導入済み)

  1. # rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
  2.  
  3. ※ScientificLinux6は以下のbaseurl修正を行う
  4. # vi /etc/yum.repos.d/groonga.repo
  5. baseurl=http://packages.groonga.org/centos/6/$basearch/
  6.  
  7. # yum makecache
  8. # yum install -y mysql-mroonga groonga-tokenizer-mecab
  9.  
  10. # mysql -u root -p
  11. mysql> show engines;
  12. mysql> INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';

■動作確認方法

  1. # mysql -u root -p
  2. mysql> show engines;
  3. mysql> use test;
  4. mysql> create table diaries ( id INT primary key auto_increment, content varchar(255), fulltext index (content) ) engine = mroonga default charset utf8;
  5. mysql> INSERT INTO diaries (content) VALUES ("明日の天気は晴れでしょう。");
  6. mysql> INSERT INTO diaries (content) VALUES ("明日の天気は雨でしょう。");
  7. mysql> SELECT * FROM diaries WHERE MATCH(content) AGAINST("晴れ");

検索できればOK。
検索スコアでソートは以下で確認。

  1. mysql> INSERT INTO diaries (content) VALUES ("今日は晴れました。明日も晴れるでしょう。");
  2. mysql> INSERT INTO diaries (content) VALUES ("今日は晴れましたが、明日は雨でしょう。");
  3. mysql> SELECT *, MATCH (content) AGAINST ("晴れ") FROM diaries WHERE MATCH (content) AGAINST ("晴れ") ORDER BY MATCH (content) AGAINST ("晴れ") DESC;

■tritonnデータからの移行
 tritonnでダンプしたデータのうち以下の部分を修正する(ストレージモードで利用)

  1.  FULLTEXT KEY `fullindex` (`body`) /*!50100 WITH PARSER `mecab` */
  2. ) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
  3.  ↓
  4.  FULLTEXT INDEX (`body`)
  5. ) ENGINE=mroonga AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;

これで新しいDBへインポートすればOK。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

CentOS6.xのELrepo Kernel パラメータ差分メモ

■CentOS6.xのELrepo Kernel パラメータ差分メモ
 前記事で導入したELrepoのKernel3.0.68とCentOS6.3のkernel2.6.32のkernelパラメータの差分を取ってみたのでメモしておく。

以下のコマンドで取得したパラメータをそれぞれのカーネルで起動して取得。

  1. # sysctl -a

kernel情報とdiffを取った結果。

  1. # uname -a
  2. Linux localhost.localdomain 3.0.68-1.el6.elrepo.i686 #1 SMP Mon Mar 4 00:29:41 EST 2013 i686 i686 i386 GNU/Linux
  3.  
  4. # diff k3s.txt k2s.txt
  5. 45c45
  6. < fs.dentry-state = 10635       4581    45      0       0       0
  7. ---
  8. > fs.dentry-state = 10781       5172    45      0       0       0
  9. 47,51c47,51
  10. < fs.epoll.max_user_watches = 345206
  11. < fs.file-max = 100510
  12. < fs.file-nr = 672      0       100510
  13. < fs.inode-nr = 9825    756
  14. < fs.inode-state = 9825 756     0       0       0       0       0
  15. ---
  16. > fs.epoll.max_user_watches = 331776
  17. > fs.file-max = 100902
  18. > fs.file-nr = 672      0       100902
  19. > fs.inode-nr = 9968    218
  20. > fs.inode-state = 9968 218     0       0       0       0       0
  21. 56a57
  22. > fs.mqueue.msg_default = 10
  23. 57a59
  24. > fs.mqueue.msgsize_default = 8192
  25. 63d64
  26. < fs.pipe-max-size = 1048576
  27. 70a72
  28. > fs.quota.warnings = 1
  29. 85a88
  30. > kernel.exec-shield = 1
  31. 87d89
  32. < kernel.ftrace_enabled = 1
  33. 94a97
  34. > kernel.kexec_load_disabled = 0
  35. 100c103
  36. < kernel.kptr_restrict = 0
  37. ---
  38. > kernel.kptr_restrict = 1
  39. 107c110
  40. < kernel.msgmni = 1740
  41. ---
  42. > kernel.msgmni = 1736
  43. 110c113
  44. < kernel.osrelease = 3.0.68-1.el6.elrepo.i686
  45. ---
  46. > kernel.osrelease = 2.6.32-279.22.1.el6.i686
  47. 116c119
  48. < kernel.panic_on_oops = 0
  49. ---
  50. > kernel.panic_on_oops = 1
  51. 129,131c132,134
  52. < kernel.pty.nr = 1
  53. < kernel.random.boot_id = f6ba4b47-c313-4466-9e3f-2e96cae9d48c
  54. < kernel.random.entropy_avail = 1247
  55. ---
  56. > kernel.pty.nr = 2
  57. > kernel.random.boot_id = 31a3cfc3-28b9-4b80-a174-7c8af4ae3590
  58. > kernel.random.entropy_avail = 131
  59. 134c137
  60. < kernel.random.uuid = 11a6f5a8-2b73-402a-8f3c-d24da95c6ccb
  61. ---
  62. > kernel.random.uuid = 0ec9460c-05d5-4552-9855-9705f3dee9a0
  63. 138c141,142
  64. < kernel.sched_autogroup_enabled = 1
  65. ---
  66. > kernel.sched_autogroup_enabled = 0
  67. > kernel.sched_cfs_bandwidth_slice_us = 5000
  68. 140c144,146
  69. < kernel.sched_latency_ns = 6000000
  70. ---
  71. > kernel.sched_compat_yield = 0
  72. > kernel.sched_features = 3183
  73. > kernel.sched_latency_ns = 5000000
  74. 142c148
  75. < kernel.sched_min_granularity_ns = 750000
  76. ---
  77. > kernel.sched_min_granularity_ns = 1000000
  78. 150a157
  79. > kernel.shm_rmid_forced = 0
  80. 153a161,163
  81. > kernel.slow-work.max-threads = 4
  82. > kernel.slow-work.min-threads = 2
  83. > kernel.slow-work.vslow-percentage = 50
  84. 155d164
  85. < kernel.stack_tracer_enabled = 0
  86. 158c167
  87. < kernel.threads-max = 15806
  88. ---
  89. > kernel.threads-max = 15876
  90. 163c172
  91. < kernel.version = #1 SMP Mon Mar 4 00:29:41 EST 2013
  92. ---
  93. > kernel.version = #1 SMP Wed Feb 6 00:31:03 UTC 2013
  94. 165c174
  95. < kernel.watchdog_thresh = 10
  96. ---
  97. > kernel.watchdog_thresh = 60
  98. 171d179
  99. < net.core.netdev_tstamp_prequeue = 1
  100. 173c181
  101. < net.core.rmem_default = 114688
  102. ---
  103. > net.core.rmem_default = 188416
  104. 178c186
  105. < net.core.wmem_default = 114688
  106. ---
  107. > net.core.wmem_default = 188416
  108. 398,420d405
  109. < net.ipv4.netfilter.ip_conntrack_buckets = 16384
  110. < net.ipv4.netfilter.ip_conntrack_checksum = 1
  111. < net.ipv4.netfilter.ip_conntrack_count = 16
  112. < net.ipv4.netfilter.ip_conntrack_generic_timeout = 600
  113. < net.ipv4.netfilter.ip_conntrack_icmp_timeout = 30
  114. < net.ipv4.netfilter.ip_conntrack_log_invalid = 0
  115. < net.ipv4.netfilter.ip_conntrack_max = 64172
  116. < net.ipv4.netfilter.ip_conntrack_tcp_be_liberal = 0
  117. < net.ipv4.netfilter.ip_conntrack_tcp_loose = 1
  118. < net.ipv4.netfilter.ip_conntrack_tcp_max_retrans = 3
  119. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_close = 10
  120. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60
  121. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 432000
  122. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120
  123. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_last_ack = 30
  124. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_max_retrans = 300
  125. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_recv = 60
  126. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent = 120
  127. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent2 = 120
  128. < net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120
  129. < net.ipv4.netfilter.ip_conntrack_udp_timeout = 30
  130. < net.ipv4.netfilter.ip_conntrack_udp_timeout_stream = 180
  131. < net.ipv4.ping_group_range = 1 0
  132. 425d409
  133. < net.ipv4.route.gc_interval = 60
  134. 436a421
  135. > net.ipv4.route.secret_interval = 600
  136. 440c425
  137. < net.ipv4.tcp_adv_win_scale = 1
  138. ---
  139. > net.ipv4.tcp_adv_win_scale = 2
  140. 445d429
  141. < net.ipv4.tcp_challenge_ack_limit = 100
  142. 447d430
  143. < net.ipv4.tcp_cookie_size = 0
  144. 463c446
  145. < net.ipv4.tcp_mem = 21180      28243   42360
  146. ---
  147. > net.ipv4.tcp_mem = 81984      109312  163968
  148. 473c456
  149. < net.ipv4.tcp_rmem = 4096      87380   903776
  150. ---
  151. > net.ipv4.tcp_rmem = 4096      87380   3497984
  152. 487c470
  153. < net.ipv4.tcp_wmem = 4096      16384   903776
  154. ---
  155. > net.ipv4.tcp_wmem = 4096      16384   3497984
  156. 489c472
  157. < net.ipv4.udp_mem = 21180      28243   42360
  158. ---
  159. > net.ipv4.udp_mem = 81984      109312  163968
  160. 506d488
  161. < net.ipv6.conf.all.force_tllao = 0
  162. 535d516
  163. < net.ipv6.conf.default.force_tllao = 0
  164. 564d544
  165. < net.ipv6.conf.eth0.force_tllao = 0
  166. 593d572
  167. < net.ipv6.conf.eth1.force_tllao = 0
  168. 622d600
  169. < net.ipv6.conf.lo.force_tllao = 0
  170. 697c675
  171. < net.ipv6.route.gc_elasticity = 9
  172. ---
  173. > net.ipv6.route.gc_elasticity = 0
  174. 704c682
  175. < net.ipv6.route.min_adv_mss = 1220
  176. ---
  177. > net.ipv6.route.min_adv_mss = 1
  178. 710c688
  179. < net.netfilter.nf_conntrack_count = 16
  180. ---
  181. > net.netfilter.nf_conntrack_count = 1
  182. 717c695
  183. < net.netfilter.nf_conntrack_max = 64172
  184. ---
  185. > net.netfilter.nf_conntrack_max = 64432
  186. 746c724
  187. < net.nf_conntrack_max = 64172
  188. ---
  189. > net.nf_conntrack_max = 64432
  190. 756a735
  191. > vm.extra_free_kbytes = 0
  192. 764,766c743
  193. < vm.min_free_kbytes = 44904
  194. < vm.min_slab_ratio = 5
  195. < vm.min_unmapped_ratio = 1
  196. ---
  197. > vm.min_free_kbytes = 3794
  198. 769d745
  199. < vm.nr_hugepages_mempolicy = 0
  200. 772d747
  201. < vm.numa_zonelist_order = default
  202. 785c760
  203. < vm.zone_reclaim_mode = 0
  204. ---
  205. > vm.would_have_oomkilled = 0
, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

CentOS5.xのELrepo Kernel パラメータ差分メモ

■CentOS5.xのELrepo Kernel パラメータ差分メモ
 前記事で導入したELrepoのKernel3.0.66とCentOS5.9のkernel2.1.18のkernelパラメータの差分を取ってみたのでメモしておく。

以下のコマンドで取得したパラメータをそれぞれのカーネルで起動して取得。

  1. # sysctl -a

diffを取った結果。
# cat k3-diff-k2.txt
2d1
< debug.exception-trace = 1 26c25 < dev.cdrom.info = Can write RAM: 1 --- dev.cdrom.info = Can write RAM: 0 29c28 < dev.cdrom.info = drive name: sr0 --- dev.cdrom.info = drive name: hdc 36a36 dev.rtc.max-user-freq = 64 41c41 < fs.dentry-state = 6192 4181 45 0 0 0 --- fs.dentry-state = 3892 2599 45 0 0 0 43,47c43,46 < fs.epoll.max_user_watches = 200546 < fs.file-max = 50584 < fs.file-nr = 224 0 50584 < fs.inode-nr = 5754 354 < fs.inode-state = 5754 354 0 0 0 0 0 --- fs.file-max = 51100 fs.file-nr = 192 0 51100 fs.inode-nr = 3429 136 fs.inode-state = 3429 136 0 0 0 0 0 59d57 < fs.pipe-max-size = 1048576 66c64,65 < fs.quota.syncs = 0 --- fs.quota.syncs = 20 fs.quota.warnings = 1 71d69 < kernel.auto_msgmni = 1 74d71 < kernel.bootloader_version = 1 75a73 kernel.cap-bound = -257 77d74 < kernel.core_pipe_limit = 0 82,83c79 < kernel.ftrace_dump_on_oops = 0 < kernel.ftrace_enabled = 1 --- kernel.exec-shield = 1 90,91d85 < kernel.io_delay_type = 0 < kernel.keys.gc_delay = 300 96,97d89 < kernel.kptr_restrict = 0 < kernel.kstack_depth_to_print = 24 103c95 < kernel.msgmni = 1001 --- kernel.msgmni = 16 105,106c97,98 < kernel.nmi_watchdog = 1 < kernel.osrelease = 3.0.66-1.el5.elrepo --- kernel.nmi_watchdog = 0 kernel.osrelease = 2.6.18-348.1.1.el5 111,112c103 < kernel.panic_on_io_nmi = 0 < kernel.panic_on_oops = 0 --- kernel.panic_on_oops = 1 114,116d104 < kernel.perf_event_max_sample_rate = 100000 < kernel.perf_event_mlock_kb = 516 < kernel.perf_event_paranoid = 1 118d105 < kernel.poweroff_cmd = /sbin/poweroff 121d107 < kernel.printk_delay = 0 126,127c112,113 < kernel.random.boot_id = 883b8f61-6fd5-42fb-9287-c08e4aaa7d3b < kernel.random.entropy_avail = 457 --- kernel.random.boot_id = ed819e04-5a67-4c80-b57c-00953773b11e kernel.random.entropy_avail = 354 130c116 < kernel.random.uuid = 1c11957b-b8e2-4e0b-bab1-dec3633f88b5 --- kernel.random.uuid = 55467d54-5ae5-4b5b-a8c8-f3fabea6264e 132c118 < kernel.randomize_va_space = 2 --- kernel.randomize_va_space = 1 134,145c120 < kernel.sched_autogroup_enabled = 1 < kernel.sched_child_runs_first = 0 < kernel.sched_latency_ns = 6000000 < kernel.sched_migration_cost = 500000 < kernel.sched_min_granularity_ns = 750000 < kernel.sched_nr_migrate = 32 < kernel.sched_rt_period_us = 1000000 < kernel.sched_rt_runtime_us = 950000 < kernel.sched_shares_window = 10000000 < kernel.sched_time_avg = 1000 < kernel.sched_tunable_scaling = 1 < kernel.sched_wakeup_granularity_ns = 1000000 --- kernel.sched_interactive = 2 150a126 kernel.softlockup_thresh = 60 153,154c129 < kernel.threads-max = 7957 < kernel.timer_migration = 1 --- kernel.threads-max = 15976 156,160c131,133 < kernel.usermodehelper.bset = 4294967295 4294967295 < kernel.usermodehelper.inheritable = 4294967295 4294967295 < kernel.version = #1 SMP PREEMPT Thu Feb 21 15:32:49 EST 2013 < kernel.watchdog = 1 < kernel.watchdog_thresh = 10 --- kernel.vdso = 1 kernel.vdso_populate = 0 kernel.version = #1 SMP Tue Jan 22 16:24:03 EST 2013 166d138 < net.core.netdev_tstamp_prequeue = 1 168,170c140,141 < net.core.rmem_default = 114688 < net.core.rmem_max = 114688 < net.core.rps_sock_flow_entries = 0 --- net.core.rmem_default = 110592 net.core.rmem_max = 110592 172,174c143,144 < net.core.warnings = 1 < net.core.wmem_default = 114688 < net.core.wmem_max = 114688 --- net.core.wmem_default = 110592 net.core.wmem_max = 110592 178c148 < net.core.xfrm_larval_drop = 1 --- net.core.xfrm_larval_drop = 0 190d159 < net.ipv4.conf.all.arp_notify = 0 201d169 < net.ipv4.conf.all.proxy_arp_pvlan = 0 206d173 < net.ipv4.conf.all.src_valid_mark = 0 215d181 < net.ipv4.conf.default.arp_notify = 0 226d191 < net.ipv4.conf.default.proxy_arp_pvlan = 0 231d195 < net.ipv4.conf.default.src_valid_mark = 0 240d203 < net.ipv4.conf.eth0.arp_notify = 0 251d213 < net.ipv4.conf.eth0.proxy_arp_pvlan = 0 256d217 < net.ipv4.conf.eth0.src_valid_mark = 0 265d225 < net.ipv4.conf.eth1.arp_notify = 0 276d235 < net.ipv4.conf.eth1.proxy_arp_pvlan = 0 281d239 < net.ipv4.conf.eth1.src_valid_mark = 0 290d247 < net.ipv4.conf.eth2.arp_notify = 0 301d257 < net.ipv4.conf.eth2.proxy_arp_pvlan = 0 306d261 < net.ipv4.conf.eth2.src_valid_mark = 0 310c265 < net.ipv4.conf.lo.accept_source_route = 0 --- net.ipv4.conf.lo.accept_source_route = 1 315d269 < net.ipv4.conf.lo.arp_notify = 0 326,327c280 < net.ipv4.conf.lo.proxy_arp_pvlan = 0 < net.ipv4.conf.lo.rp_filter = 1 --- net.ipv4.conf.lo.rp_filter = 0 331d283 < net.ipv4.conf.lo.src_valid_mark = 0 432d383 < net.ipv4.ping_group_range = 1 0 437d387 < net.ipv4.route.gc_interval = 60 441a392 net.ipv4.route.max_delay = 10 443a395 net.ipv4.route.min_delay = 2 449c401,402 < net.ipv4.rt_cache_rebuild_count = 4 --- net.ipv4.route.rt_cache_rebuild_count = 4 net.ipv4.route.secret_interval = 600 452,453c405 < net.ipv4.tcp_adv_win_scale = 1 < net.ipv4.tcp_allowed_congestion_control = bic reno --- net.ipv4.tcp_adv_win_scale = 2 455d406 < net.ipv4.tcp_available_congestion_control = bic reno 457d407 < net.ipv4.tcp_challenge_ack_limit = 100 459d408 < net.ipv4.tcp_cookie_size = 0 462c411 < net.ipv4.tcp_ecn = 2 --- net.ipv4.tcp_ecn = 0 465,466c414 < net.ipv4.tcp_frto = 2 < net.ipv4.tcp_frto_response = 0 --- net.ipv4.tcp_frto = 0 471,475c419,422 < net.ipv4.tcp_max_orphans = 8192 < net.ipv4.tcp_max_ssthresh = 0 < net.ipv4.tcp_max_syn_backlog = 128 < net.ipv4.tcp_max_tw_buckets = 8192 < net.ipv4.tcp_mem = 12177 16239 24354 --- net.ipv4.tcp_max_orphans = 4096 net.ipv4.tcp_max_syn_backlog = 1024 net.ipv4.tcp_max_tw_buckets = 180000 net.ipv4.tcp_mem = 12288 16384 24576 485c432 < net.ipv4.tcp_rmem = 4096 87380 519648 --- net.ipv4.tcp_rmem = 4096 87380 524288 492,493d438 < net.ipv4.tcp_thin_dupack = 0 < net.ipv4.tcp_thin_linear_timeouts = 0 499c444 < net.ipv4.tcp_wmem = 4096 16384 519648 --- net.ipv4.tcp_wmem = 4096 16384 524288 501c446 < net.ipv4.udp_mem = 12177 16239 24354 --- net.ipv4.udp_mem = 49056 65408 98112 504,517d448 < net.ipv4.xfrm4_gc_thresh = 32768 < net.netfilter.nf_log.0 = NONE < net.netfilter.nf_log.1 = NONE < net.netfilter.nf_log.10 = NONE < net.netfilter.nf_log.11 = NONE < net.netfilter.nf_log.12 = NONE < net.netfilter.nf_log.2 = NONE < net.netfilter.nf_log.3 = NONE < net.netfilter.nf_log.4 = NONE < net.netfilter.nf_log.5 = NONE < net.netfilter.nf_log.6 = NONE < net.netfilter.nf_log.7 = NONE < net.netfilter.nf_log.8 = NONE < net.netfilter.nf_log.9 = NONE 525c456 < vm.dirty_ratio = 20 --- vm.dirty_ratio = 40 528,530c459 < vm.extfrag_threshold = 500 < vm.highmem_is_dirtyable = 0 < vm.hugepages_treat_as_movable = 0 --- vm.flush_mmap_pages = 1 534,536c463,467 < vm.lowmem_reserve_ratio = 256 32 32 < vm.max_map_count = 65530 < vm.min_free_kbytes = 2883 --- vm.lowmem_reserve_ratio = 256 256 32 vm.max_map_count = 65536 vm.max_reclaims_in_progress = 0 vm.max_writeback_pages = 1024 vm.min_free_kbytes = 2896 539,542c470 < vm.nr_overcommit_hugepages = 0 < vm.nr_pdflush_threads = 0 < vm.oom_dump_tasks = 1 < vm.oom_kill_allocating_task = 0 --- vm.nr_pdflush_threads = 2 545a474 vm.pagecache = 100 548,549c477 < vm.scan_unevictable_pages = 0 < vm.stat_interval = 1 --- vm.swap_token_timeout = 300 550a479 vm.topdown_allocate_fast = 0 552a482 vm.vm_devzero_optimized = 1[/code]

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

CentOS5.xでdstatの–top-ioオプションを使う

■CentOS5.xでdstatの–top-ioオプションを使う
CentOS5.xで極短時間でもI/O負荷を上げているプロセスを特定する方法としてdstatを使うことでそれが可能です。しかしdstatの–top-ioオプションはketnel2.6.20以上が必要で、CentOS5.x標準のkernel2.6.18では利用できません。そこでCentOS5.xでもそれを利用する方法を調べてみました。

dstat
http://dag.wieers.com/home-made/dstat/dstat.1.html

今回はELrepoというハードウェアリポジトリから3.0系のkernelを導入します。
ELrepoはCentOS/RedHat用のリポジトリで、既存のソフトウェアパッケージ群と整合性があります。kernelアップデートしても既存のソフトウェアが勝手にバージョンアップされることはありません。

  1. # rpm -ivh http://elrepo.org/elrepo-release-5-4.el5.elrepo.noarch.rpm
  2. # vi /etc/yum.repos.d/elrepo.repo
  3.  
  4. [elrepo-kernel]
  5. name=ELRepo.org Community Enterprise Linux Kernel Repository - el5
  6. baseurl=http://elrepo.org/linux/kernel/el5/$basearch/
  7. mirrorlist=http://elrepo.org/mirrors-elrepo-kernel.el5
  8. enabled=1
  9. gpgcheck=1
  10. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
  11. protect=0
  12.  
  13. # yum update
  14. # yum install kernel-lt kernel-lt-devel

kernel3.0で起動するとudevの起動時にエラーメッセージが出るので以下を修正。

  1. # vi /etc/udev/rules.d/05-udev-early.rules
  2. ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
  3.  ↓
  4. #ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
  5.  
  6. ※iscsiが使われていないこと。iscsiを有効のまま使う場合は以下。
  7. ACTION=="add", SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt"
  8.  
  9. # reboot

起動画面で3.0kernel選択、起動後に起動kernelを確認する。

  1. # uname -r
  2. 3.0.66-1.el5.elrepo を確認

これでdstatのフル機能が利用できるようになります。
dstatは最新版をインストールします。

  1. # wget http://dag.wieers.com/home-made/dstat/dstat-0.7.2.tar.bz2
  2. # tar jxvf dstat-0.7.2.tar.bz2
  3. # cd dstat-0.7.2
  4. # ./dstat -alt --top-io --top-bio --top-cpu --top-cputime --top-cputime-avg --top-mem

各ディスクやネットワーク単位でトラフィックを取得する場合

  1. # ./dstat -cdnlt -N eth0,eth1,total -D sda1,sda2,sda3,total --top-io --top-bio --top-cpu --top-cputime --top-cputime-avg --top-mem

ファイルに書く場合は2つ方法があります。

CSV用のカンマ区切り(画面も表示)

  1. # ./dstat -cdnlt -N eth0,eth1,total -D sda1,sda2,sda3,total --top-io --top-bio --top-cpu --top-cputime --top-cputime-avg --top-mem -o filename

terminal画面の出力をそのまま保存(画面表示無)

  1. # ./dstat -cdnlt -N eth0,eth1,total -D sda1,sda2,sda3,total --top-io --top-bio --top-cpu --top-cputime --top-cputime-avg --top-mem > filename

これによって1秒ごとにサーバの動作状況とその時に最も活動しているプロセスとその対象をいくつかの指標でログに取得できます。

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Linuxで同時オープンされているファイルの数を確認する方法
OS全体で開いているファイルと特定プロセスが開いているファイルを確認する方法。負荷試験をやっている最中にパフォーマンスがでない時、確認すると意外とこれに引っかかっていることもあるので注意。OSのチューニングはちゃんとしようw

# cat /proc/sys/fs/file-nr
表示される3つの数字のうち一番左

■CommuniGate Proで同時オープンされているファイルの数を確認する方法
# ps aux | grep CGS
プロセス番号を確認
# ls /proc/プロセス番号/fd/ | wc -l
表示された数字

,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■さくらのVPS 8GのIOPSを調べてみた
 レスポンスが酷くなって死に体だった某SNSがさくらのVPS 8Gにサーバを移設したことでサクサク快適になったと聞いて、お試しを利用して比較的負荷の高いSNSサービスを快適に提供できるIOPSというのはどのくらいなのかを調べてみた。VPSのOSがCentOS6 x86_64なので調査に使ったのはfioとorion。fioでは8k,10MB,128MBの3つのサイズを、orionではディスクの数を指定するパラメーターで負荷を上げることができることで今回は1,4,8で試してみた。SNSサービスを前提にするならデータベースに近い測定方法のorionの結果を重視するのでいいのではないかと思う。

 非常に興味深かったのは負荷かけながらtopで様子を見ていたところ、さくらのVPSでは大きな負荷をかけてもiowaitが16%前後で頭打ちになり、他のVPSに大きな迷惑をかけないよううまく制御されているように見えたこと。見ている限りfioでもorionでもCPUは数%程度、iowaitも16%までと非常に余裕を持って動作していた。これならおそらく他のVPSからの影響も大きく受けることなく安定してサーバ運用ができると思われる。

■fioの結果
1)サイズ 8K IOPS 2000

  1. # fio random-read-test.fio
  2. random-read: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1
  3. fio-2.0.9
  4. Starting 1 process
  5.  
  6. random-read: (groupid=0, jobs=1): err= 0: pid=1659: Sat Nov 17 22:16:19 2012
  7.   read : io=8192 B, bw=8000.0KB/s, iops=2000 , runt=     1msec
  8.     clat (usec): min=355 , max=550 , avg=452.50, stdev=137.89
  9.      lat (usec): min=356 , max=550 , avg=453.00, stdev=137.18
  10.     clat percentiles (usec):
  11.      |  1.00th=[  354],  5.00th=[  354], 10.00th=[  354], 20.00th=[  354],
  12.      | 30.00th=[  354], 40.00th=[  354], 50.00th=[  354], 60.00th=[  548],
  13.      | 70.00th=[  548], 80.00th=[  548], 90.00th=[  548], 95.00th=[  548],
  14.      | 99.00th=[  548], 99.50th=[  548], 99.90th=[  548], 99.95th=[  548],
  15.      | 99.99th=[  548]
  16.     lat (usec) : 500=50.00%, 750=50.00%
  17.   cpu          : usr=0.00%, sys=0.00%, ctx=2, majf=0, minf=27
  18.   IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
  19.      submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  20.      complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  21.      issued    : total=r=2/w=0/d=0, short=r=0/w=0/d=0
  22.  
  23. Run status group 0 (all jobs):
  24.    READ: io=8KB, aggrb=8000KB/s, minb=8000KB/s, maxb=8000KB/s, mint=1msec, maxt=1msec
  25.  
  26. Disk stats (read/write):
  27.   vda: ios=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00%

2)サイズ 10M IOPS 3932

  1. # fio random-read-test.fio
  2. random-read: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1
  3. fio-2.0.9
  4. Starting 1 process
  5. random-read: Laying out IO file(s) (1 file(s) / 10MB)
  6.  
  7. random-read: (groupid=0, jobs=1): err= 0: pid=1647: Sat Nov 17 22:06:54 2012
  8.   read : io=10240KB, bw=15730KB/s, iops=3932 , runt=   651msec
  9.     clat (usec): min=174 , max=566 , avg=247.94, stdev=39.81
  10.      lat (usec): min=174 , max=567 , avg=248.42, stdev=39.81
  11.     clat percentiles (usec):
  12.      |  1.00th=[  185],  5.00th=[  199], 10.00th=[  207], 20.00th=[  219],
  13.      | 30.00th=[  229], 40.00th=[  235], 50.00th=[  241], 60.00th=[  247],
  14.      | 70.00th=[  258], 80.00th=[  274], 90.00th=[  294], 95.00th=[  330],
  15.      | 99.00th=[  382], 99.50th=[  410], 99.90th=[  486], 99.95th=[  490],
  16.      | 99.99th=[  564]
  17.     bw (KB/s)  : min=15560, max=15560, per=98.93%, avg=15560.00, stdev= 0.00
  18.     lat (usec) : 250=63.75%, 500=36.21%, 750=0.04%
  19.   cpu          : usr=2.31%, sys=14.77%, ctx=2560, majf=0, minf=27
  20.   IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
  21.      submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  22.      complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  23.      issued    : total=r=2560/w=0/d=0, short=r=0/w=0/d=0
  24.  
  25. Run status group 0 (all jobs):
  26.    READ: io=10240KB, aggrb=15729KB/s, minb=15729KB/s, maxb=15729KB/s, mint=651msec, maxt=651msec
  27.  
  28. Disk stats (read/write):
  29.   vda: ios=2390/0, merge=0/0, ticks=430/0, in_queue=425, util=60.03%

3)サイズ 128MB IOPS 4300

  1. # fio random-read-test.fio
  2. random-read: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1
  3. fio-2.0.9
  4. Starting 1 process
  5. random-read: Laying out IO file(s) (1 file(s) / 128MB)
  6. Jobs: 1 (f=1): [r] [100.0% done] [18308K/0K /s] [4577 /0  iops] [eta 00m:00s]
  7. random-read: (groupid=0, jobs=1): err= 0: pid=1651: Sat Nov 17 22:09:38 2012
  8.   read : io=131072KB, bw=17201KB/s, iops=4300 , runt=  7620msec
  9.     clat (usec): min=149 , max=907 , avg=226.51, stdev=33.92
  10.      lat (usec): min=150 , max=907 , avg=227.01, stdev=33.93
  11.     clat percentiles (usec):
  12.      |  1.00th=[  167],  5.00th=[  175], 10.00th=[  181], 20.00th=[  197],
  13.      | 30.00th=[  209], 40.00th=[  219], 50.00th=[  231], 60.00th=[  239],
  14.      | 70.00th=[  243], 80.00th=[  249], 90.00th=[  262], 95.00th=[  278],
  15.      | 99.00th=[  322], 99.50th=[  350], 99.90th=[  422], 99.95th=[  454],
  16.      | 99.99th=[  644]
  17.     bw (KB/s)  : min=16136, max=19488, per=99.96%, avg=17194.67, stdev=1014.85
  18.     lat (usec) : 250=80.75%, 500=19.22%, 750=0.02%, 1000=0.01%
  19.   cpu          : usr=2.61%, sys=16.14%, ctx=32769, majf=0, minf=27
  20.   IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
  21.      submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  22.      complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
  23.      issued    : total=r=32768/w=0/d=0, short=r=0/w=0/d=0
  24.  
  25. Run status group 0 (all jobs):
  26.    READ: io=131072KB, aggrb=17201KB/s, minb=17201KB/s, maxb=17201KB/s, mint=7620msec, maxt=7620msec
  27.  
  28. Disk stats (read/write):
  29.   vda: ios=31738/3, merge=0/0, ticks=5512/0, in_queue=5490, util=73.44%

■orionの結果
1)DISK数1 IOPS 879

  1. # ./orion_linux_x86-64 -run oltp -testname vps -num_disks 1
  2. # cat vps_20121117_xxxx_summary.txt
  3. ORION VERSION 11.1.0.7.0
  4.  
  5. Commandline:
  6. -run oltp -testname vps -num_disks 1
  7.  
  8. This maps to this test:
  9. Test: vps
  10. Small IO size: 8 KB
  11. Large IO size: 1024 KB
  12. IO Types: Small Random IOs, Large Random IOs
  13. Simulated Array Type: CONCAT
  14. Write: 0%
  15. Cache Size: Not Entered
  16. Duration for each Data Point: 60 seconds
  17. Small Columns:,      1,      2,      3,      4,      5,      6,      7,      8,      9,     10,     11,     12,     13,     14,     15,     16,     17,     18,     19,     20
  18. Large Columns:,      0
  19. Total Data Points: 21
  20.  
  21. Name: /dev/vda3 Size: 856582766080
  22. 1 FILEs found.
  23.  
  24. Maximum Small IOPS=879 @ Small=20 and Large=0
  25. Minimum Small Latency=8.03 @ Small=1 and Large=0

2)DISK数4 IOPS 1210

  1. # ./orion_linux_x86-64 -run oltp -testname vps -num_disks 4
  2. # cat vps_20121117_xxxx_summary.txt
  3. ORION VERSION 11.1.0.7.0
  4.  
  5. Commandline:
  6. -run oltp -testname vps -num_disks 4
  7.  
  8. This maps to this test:
  9. Test: vps
  10. Small IO size: 8 KB
  11. Large IO size: 1024 KB
  12. IO Types: Small Random IOs, Large Random IOs
  13. Simulated Array Type: CONCAT
  14. Write: 0%
  15. Cache Size: Not Entered
  16. Duration for each Data Point: 60 seconds
  17. Small Columns:,      4,      8,     12,     16,     20,     24,     28,     32,     36,     40,     44,     48,     52,     56,     60,     64,     68,     72,     76,     80
  18. Large Columns:,      0
  19. Total Data Points: 24
  20.  
  21. Name: /dev/vda3 Size: 856582766080
  22. 1 FILEs found.
  23.  
  24. Maximum Small IOPS=1210 @ Small=76 and Large=0
  25. Minimum Small Latency=10.66 @ Small=4 and Large=0

3)DISK数8 IOPS 1214

  1. # ./orion_linux_x86-64 -run oltp -testname vps -num_disks 8
  2. # cat vps_20121117_xxxx_summary.txt
  3. ORION VERSION 11.1.0.7.0
  4.  
  5. Commandline:
  6. -run oltp -testname vps -num_disks 8
  7.  
  8. This maps to this test:
  9. Test: vps
  10. Small IO size: 8 KB
  11. Large IO size: 1024 KB
  12. IO Types: Small Random IOs, Large Random IOs
  13. Simulated Array Type: CONCAT
  14. Write: 0%
  15. Cache Size: Not Entered
  16. Duration for each Data Point: 60 seconds
  17. Small Columns:,      8,     16,     24,     32,     40,     48,     56,     64,     72,     80,     88,     96,    104,    112,    120,    128,    136,    144,    152,    160
  18. Large Columns:,      0
  19. Total Data Points: 28
  20.  
  21. Name: /dev/vda3 Size: 856582766080
  22. 1 FILEs found.
  23.  
  24. Maximum Small IOPS=1214 @ Small=120 and Large=0
  25. Minimum Small Latency=13.30 @ Small=8 and Large=0

■参考
1)ASUS K55DR + Samsung 830 SSD

  1. # ./orion_linux_x86-64 -run oltp -testname test -num_disks 4
  2. # less test_20121117_xxxx_summary.txt
  3. ORION VERSION 11.1.0.7.0
  4.  
  5. Commandline:
  6. -run oltp -testname test -num_disks 4
  7.  
  8. This maps to this test:
  9. Test: test
  10. Small IO size: 8 KB
  11. Large IO size: 1024 KB
  12. IO Types: Small Random IOs, Large Random IOs
  13. Simulated Array Type: CONCAT
  14. Write: 0%
  15. Cache Size: Not Entered
  16. Duration for each Data Point: 60 seconds
  17. Small Columns:,      4,      8,     12,     16,     20,     24,     28,     32,     36,     40,     44,     48,     52,     56,     60,     64,     68,     72,     76,     80
  18. Large Columns:,      0
  19. Total Data Points: 24
  20.  
  21. Name: /dev/mapper/vg_mx-lv_root Size: 121769033728
  22. 1 FILEs found.
  23.  
  24. Maximum Small IOPS=25169 @ Small=72 and Large=0
  25. Minimum Small Latency=0.19 @ Small=4 and Large=0

2)DELL D520 + Hitachi HTS723232A7A364

  1. # ./orion_linux_x86-64 -run oltp -testname test -num_disks 4
  2. # less test_20121117_xxxx_summary.txt
  3. ORION VERSION 11.1.0.7.0
  4.  
  5. Commandline:
  6. -run oltp -testname test -num_disks 1
  7.  
  8. This maps to this test:
  9. Test: test
  10. Small IO size: 8 KB
  11. Large IO size: 1024 KB
  12. IO Types: Small Random IOs, Large Random IOs
  13. Simulated Array Type: CONCAT
  14. Write: 0%
  15. Cache Size: Not Entered
  16. Duration for each Data Point: 60 seconds
  17. Small Columns:,      1,      2,      3,      4,      5,      6,      7,      8,      9,     10,     11,     12,     13,     14,     15,     16,     17,     18,     19,     20
  18. Large Columns:,      0
  19. Total Data Points: 21
  20.  
  21. Name: /dev/sda3 Size: 314460679680
  22. 1 FILEs found.
  23.  
  24. Maximum Small IOPS=94 @ Small=20 and Large=0
  25. Minimum Small Latency=17.53 @ Small=1 and Large=0

■まとめ
 さくらVPS 8Gの環境はorionのテストにおいてSSDには遠く及ばないが、通常のHDDの約12倍のパフォーマンスを出していることが確認できた。VPSとしては十分な速度だと思われる。IOPSのテストツールとしてfioとorionを比較した場合、fioの方がIOPSを高めに出す傾向があるようだ。ファイルの読み出しという点ではキャッシュなども動作するため、IOPSが高くなる傾向があってもおかしくない。SNS等のデータベースの利用度の高いアプリケーションではorionを使ったIOPSで評価を行う方がより現実的なレスポンスに近い結果が得られるのではないかとテスト結果からも感じられた。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■munin用CommuniGate Pro監視プラグインサンプル
 CommuniGate Proの各プロトコルの接続状況を確認できるプラグインのサンプル。net-snmpとCommuniGate Pro側のsnmpサーバ設定が必須。OS側のsnmp設定と重ならないようにするためにCGPのポート番号を変更している場合には ホストIP:ポート番号 で記述する。

■プラグインを作成する
# vi /etc/munin/plugins/cgp_active
以下

  1. #!/bin/sh
  2.  
  3. if [ "$1" = "autoconf" ]; then
  4.        if [ -x /usr/bin/snmpwalk ]; then
  5.                echo yes
  6.                exit 0
  7.        else
  8.                echo no
  9.                exit 1
  10.        fi
  11. fi
  12.  
  13. if [ "$1" = "config" ]; then
  14.  
  15.        # ___WARNING=10000
  16.  
  17.        echo 'graph_title CGP Active Sessions'
  18.        echo "graph_args -l 0"
  19.        echo 'graph_vlabel CGP Active Sessions'
  20.        echo 'graph_info This graph shows CGP Active Sessions'
  21.        echo 'graph_category CGP'
  22.  
  23.        echo 'sip_server.label SIP Server'
  24.        echo 'sip_server.draw LINE2'
  25.        echo "sip_server.info SIP Server"
  26.  
  27.        echo 'sip_clients.label SIP Clients'
  28.        echo 'sip_clients.draw LINE2'
  29.        echo "sip_clients.info SIP Clients"
  30.  
  31.        echo 'sip_act.label SIP Con'
  32.        echo 'sip_act.draw LINE2'
  33.        echo "sip_act.info SIP Con"
  34.  
  35.        echo 'media_act.label Media Ch'
  36.        echo 'media_act.draw LINE2'
  37.        echo "media_act.info Media Ch"
  38.  
  39.        echo 'media_leg.label Media Leg'
  40.        echo 'media_leg.draw LINE2'
  41.        echo "media_leg.info Media Leg"
  42.  
  43.        echo 'prox_act.label Proxy'
  44.        echo 'prox_act.draw LINE2'
  45.        echo "prox_act.info Proxy"
  46.  
  47.        echo 'ximss.label XIMSS'
  48.        echo 'ximss.draw LINE2'
  49.        echo "ximss.info XIMSS"
  50.  
  51.        echo 'airsync.label AirSync'
  52.        echo 'airsync.draw LINE2'
  53.        echo "airsync.info AirSync"
  54.  
  55.        exit 0
  56. fi
  57.  
  58.        echo -n "sip_server.value "
  59.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.2.1 | awk '{ print $4 }'
  60.  
  61.        echo -n "sip_clients.value "
  62.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.3.1 | awk '{ print $4 }'
  63.  
  64.        echo -n "sip_act.value "
  65.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.1.41 | awk '{ print $4 }'
  66.  
  67.        echo -n "media_act.value "
  68.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.15.1 | awk '{ print $4 }'
  69.  
  70.        echo -n "media_leg.value "
  71.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.15.21 | awk '{ print $4 }'
  72.  
  73.        echo -n "prox_act.value "
  74.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.7.1 | awk '{ print $4 }'
  75.  
  76.        echo -n "ximss.value "
  77.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.10.1 | awk '{ print $4 }'
  78.  
  79.        echo -n "airsync.value "
  80.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.15.1 | awk '{ print $4 }'

■値が取得できることを確認する
# cd /etc/munin/plugins/
# munin-run cgp_active

, , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CentOS6系のMySQLで日本語全文検索
CentOS6系のMySQLは5.1になっているため、日本語全文検索用途で5.0系で使ってきたTritonnが使えない。そのため新たにftppc mecabプラグインを導入し代替とする。参考した記事は以下。

http://www.genteel.org/?p=132
http://mironal-memo.blogspot.jp/2012/07/vpscentos-6mecab.html

■以下インストール手
gccとgcc-c++,mysql-devel必須

  1. # yum install gcc gcc-c++ mysql-devel libicu libicu-devel
  2. # wget http://mecab.googlecode.com/files/mecab-0.994.tar.gz
  3. # wget http://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz
  4. # tar zxvf mecab-0.994.tar.gz
  5. # cd mecab-0.994
  6. # ./configure
  7. # make && make install
  8. # ../
  9. # tar zxvf mecab-ipadic-2.7.0-20070801.tar.gz
  10. # cd mecab-ipadic-2.7.0-20070801
  11. # ./configure --with-cherset=utf-8
  12. # make && make install
  13. # ../
  14. # wget http://jaist.dl.sourceforge.net/project/mysqlftppc/mysqlftppc/1.6.1/mysqlftppc-mecab-1.6.1.tar.gz
  15. # cd mysqlftppc-mecab-1.6.1
  16. # ./configure && make && make install

MySQLへのプラグイン導入

  1. mysql> INSTALL PLUGIN mecab SONAME 'libftmecab.so.0.0.0';
  2. mysql> show plugin;
  3. mysql> show status like "mecab_info";

導入できたか検索で確認

  1. mysql> use test
  2. mysql> CREATE TABLE me (c TEXT, FULLTEXT(c) WITH PARSER mecab);
  3. mysql> show create table me\G
  4. mysql> INSERT INTO me VALUES("今日の天気は晴れです。");
  5. mysql> SELECT * FROM me WHERE MATCH(c) AGAINST('+"今日の天気"' IN BOOLEAN MODE);
  6. mysql> explain SELECT * FROM me WHERE MATCH(c) AGAINST('+"今日の天気"' IN BOOLEAN MODE);

Tritonnで作成したindexをダンプ後編集して取り込む時の修正方法

  1. 変更前
  2. USING NGRAM, NORMALIZE, 512 (`body`)
  3.  
  4. 変更後
  5. (`body`) /*!50100 WITH PARSER `mecab` */
, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...