クラウドを活用してソフトウェア開発を効率化するためのアイデアやノウハウを共有。 エンジニア、アーキテクシャー、プログラミング、DevOps、CIなどについて現場で使えるアイデアを発信します。…
クラウドを活用してソフトウェア開発を効率化するためのアイデアやノウハウを共有。 エンジニア、アーキテクシャー、プログラミング、DevOps、CIなどについて現場で使えるアイデアを発信します。…
サーバの負荷などの監視に使うコマンドいろいろ [参考記事] ログをリアルタイムに表示させて監視する方法 [参考記事] PHPでロードアベレージを表示させる方法 [参考記事] Cacti RRDToolを利用したサーバ監視ツール ロードアベレージ(CPU負荷状態) w または uptime ディスク使用率 df メモリ使用状況 free 起動中のタスク ps aux ロードアベレージ、メモリ使用状況、タスク(負荷順) top ディスクI/O iostat リアルタイムで見るには watch iostat iostatを利用するにはsysstatのインストールが必要です。 yum install sysstat その他いろいろ sar -u 3 10 sarとはSystem Admin Reporterの略です。 CPUやネットワーク、メモリ、ディスクなどの情報を見ることができます。 ログは日
目的 自宅サーバのハードがとてもとても古くなってきたので、新しいPCへ移行させます。そのときの作業のメモです。 個々の作業の一部については別記事にします。 環境やデータは基本的にそのまま、OSは CentOS 5.3 から CentOS 5.5 へマイナーバージョンアップします。HDDはSATAが2台で、LinuxのソフトウェアRAID機能を使ってRAID1(ミラーリング)を組みます。 手順概略 自分の環境では、Webのデータもメールのデータも全部/homeに入れる構成にしてたので、/homeの移行がメインになります。 CentOS 5.5 のインストールDVDを作成する(id:hachiilcane:20110224:1298559508) 新しいPCにCentOS 5.5をインストールする インストールの最初のほうに出てくるGUIを使ってソフトウェアRAIDの設定をする インストールす
犬の延命治療と尊厳死について 先日、飼育していた犬が死にました 犬種はミニチュアダックスで、17年以上生きました。ミニチュアダックスは他の犬 … 続きを読む→
Linux の連続稼働時間が 208.5 日を過ぎた段階で突如 Kernel Panic を引き起こすという過激な挙動で2011年の年の瀬に話題となった "旧208.5日問題" ですが、あれから二年が経った今、Linux Kernel 内の bug と Intel Xeon CPU の bug の合わせ技により再度類似の不具合が発生することが分かっています。 旧 208.5 日問題の発生原理に関しては以下の blog が参考になります。 okkyの銀河制圧奇譚 : sched_clock() overflow after 208.5 days in Linux Kernel 追記(2014/1/4) 新208.5日問題の簡易チェックツールを作成しました。よろしければお使い下さい。 tsc_checker - 新208.5日問題簡易チェックツール また、Linux Kernel における時間
ところがこのリスト、RIR statistics exchange format にも書いてあるように、「開始 IP アドレスから何個」という表現になっているので、そのままではサブネット マスクや CIDR の表現としては使えないレコードがあります。例えば、 192.168.0.0 から 768 個 768 個を表すサブネット マスクはない。 したがって、192.168.0.0/255.255.254.0 と 192.168.2.0/255.255.255.0 の二つに分けなければならない。 192.168.3.0 から 512 個 512 個なのでサブネット マスクは 255.255.254.0 だが、ホスト アドレス部が 0 になっていないため、単純に 192.168.3.0/255.255.254.0 とすることができない。 したがって、192.168.3.0/255.255.255
一体、Webサイトを持たない組織は今どれくらいあるでしょうか。 Webサーバを自前で持つ、ホスティングサービスを利用する、など運用形態はさまざまですが、Webサイトを持たない組織はほとんどないと思える程に Webは普及しています。 ファイアウォールはほとんどの組織で導入済みであり、多くのWebサーバはファイアウォールの中で運用されているのが一般的です。 しかしながら、最も普及しているファイアウォールはIPアドレス、ポートレベルでのフィルタリングです。この方法でのフィルタリングでは、許可していないサービスが持つ脆弱性を狙った攻撃を阻止できるため有用ではありますが、HTTPを許可している場合Web自体への攻撃に対して無力です。一方で、HTTPを不許可にした場合にはWebサイトへアクセスできなくなってしまうため本来の目的を達成できません。しかもここ数年、Webサイトを狙ったワームや不正アクセスは
斎藤です。こんにちは。 今日は、デーモンの起動・終了に際してはserviceコマンドを使った方がいいよ、というお話です。 ※CentOS 6.4 (x86_64) でテストしています。尚、特記がある所を除きます。 デーモンの起動・終了には大きく2手 Linux、特にRedHat, CentOS, Fedora, Ubuntu[1]などでは、デーモンの起動・終了の制御の際に、大きく分けて次の2つの方法を用いる事ができます。 "/etc/init.d/"配下のスクリプト(以下、スクリプト)を直接実行する "service"コマンドを実行する 一見、同じ事をやっているように思えるのですが、実は違う部分があります。それは、起動スクリプトが扱う環境変数が違うのです。次の節で、検証してみます。 扱う環境変数が違う スクリプトを直接実行する場合は、実行時の際の環境変数をそのまま利用します。一方、serv
Webサイトの改ざん事件が多発しています。Webサイトに対する基本的なセキュリティ施策を実施していればまず被害にあうことはないとは思うものの、全ての手口が公開されているわけではないので、何となく「嫌な感じ」もします。 【参考】 Web サイト改ざんに関する注意喚起(JPCERT/CC) 2013年6月の呼びかけ 「 ウェブサイトが改ざんされないように対策を! 」(IPA) @Police ウェブサイト改ざん事案の多発に係る注意喚起について(pdf) 5月から多発しているHP改ざんインシデントをまとめてみた。 - piyolog 当方のサイト(会社、個人)は、一通りのセキュリティ施策は実施しているつもりですが、絶対に改ざんされないかというと、改ざんされることは想定しておかなければならないと考えています。 当方のセキュリティ施策の例 FTPをやめ、sshのみで管理運用 sshのパスワード認証を
2013年6月7日 22:04更新: Upstartのデフォルトの設定ファイルを書き換えない方法に変更しました。hitoさんありがとうございます。 lxcなどのバージョンを記載しました。 はじめに Chefを使っていると、役割やサービスごとに環境を分離したくなります。 しかし、個人レベルで大してトラフィックがない段階で、サービスごとに仮想サーバーを借りていてはお金が足りません。 そこで、安価なVPS上でLinux Container (LXC) を使うことで、複数のサーバーを作ります。 スケールしたくなったときは、コンテナを潰して、新しく仮想サーバーを借りてChefで同様の設定をすれば手軽にスケールできると考えています。 Heroku使えば?と言われるかもしれませんが、色々なミドルウェアを利用したり、バックグラウンドで処理をしようとすると、たちまちお金がかかるので、VPSをやりくりして遊び
ハッキング Wiki † ハッキングの関連のあれこれについてまとめてみようと思っているwikiです。悪いことには使わないでください(たぶん使えないと思いますが)。 内容は少しずつ充実させていきたいと思っていますが、wikiの使い方はあまりわかっていないので事故で消えるかもしれません。 硬いので文体を「ですます」にしようと思います。 誰も編集しないので編集できないように戻しました。編集したい人はyamamoto at bogus.jp宛にメールするか、blogにでも書き込むか、電話でもしてください。。 ↑
RHELやCentOSのネットワークインタフェースって静的IPアドレスを付与するときでもやたら起動が遅くないですか。 ネットワークインタフェースが2,3個程度なら大した問題ではないのですが、例えばVLANをたくさん食わせている場合などはやたら遅くて話にならんレベルです。 Bringing up loopback interface: [ OK ] ←loは早い Bringing up interface eth0: [ OK ] ←遅い Bringing up interface eth0.1: [ OK ] ←VLANも遅い Bringing up interface eth0.2: [ OK ] ←遅いよ Bringing up interface eth0.3: [ OK ] ←遅いってばifupコマンドでかかる時間を確認したところ、1ネットワークインタフェースあたり約5秒。ネットワ
2012-11-02 結論から言えば、とりあえず RHLE6/CentOS6 な人は /etc/resolv.conf に options single-request-reopen を書いておこうという話です(全部小文字ですよ、念のため) なぜか? RHEL5/CentOS5/Ubuntu 10.04なLinuxとかでは、FQDN の解決をするときに DNSキャッシュサーバに AAAA RR の Queryを投げる AAAA RR の Reply を受ける DNSキャッシュサーバに A RR の Queryを投げる A RR の Reply を受ける という挙動でしたが、RHEL6/CentOS6 では DNSキャッシュサーバに A RR の Queryを投げる DNSキャッシュサーバに AAAA RR の Queryを投げる A RR の Reply を受ける AAAA RR の Re
sar で収集したリソース使用情報が sadf コマンドで TSV として出力 (2014/8/6追記) sar で収集したリソース使用情報が sadf コマンドで TSV として出力できる - 宮川拓の日記 ↑全く知りませんでした 私がよく利用するoption (2013/8/6追記. よく忘れるので) $ sar -r -s 00:00:00 -e 01:00:00 -f /var/log/sa/sa03 オプション 内容 例 -q load average $ sar -q -u cpu使用率 $ sar -u -b I/O回数とデータ量 $ sar -b -r メモリとスワップ使用率 $ sar -r -s 開始時間 $ sar -s 00:00:00 -e 終了時間 $ sar -e 03:00:00 -f 日付 ※ $ sar -f /var/log/sa/sa03 ※「
サーバの動作に異常が発生した際に原因を探るためのLinuxコマンドで、自分用のメモです。 全てmanとかググったら出てくるので説明は適当です。思いついたら後で追記していくかもです。 対象はDebian Squeezeになります。 全てパッケージインストールできるもので、パッケージ名は [in packagename] としてあります。 各所よりコメントありがとうございます。 良さ気なコマンドは追記していきます。 <追加したコマンド> * telnet (+コメント wget, netcat) * arp (+コメント arpwatch) * pstree * fdisk コメントに gdisk * host, dig * watch * reboot
更新履歴 2012-08-28: URL 公開 2012-08-29: futex、hrtimer、MySQL の発生条件、NTP SLEW モードに関する @odhrfm さんからの情報、キーワード更新、その他いろいろ細かい修正 2012-08-30: 参考リンク追加 2012-09-01: LKML まとめシートの thread#50 を追加 2012-09-03: SLES カーネルの更新情報、per-cpu についての記述、blockdiag によるブロック図を追加 2012-09-11: LKML まとめシートの thread#52, #53 を追加 2012-09-12: LKML まとめシートの thread#54 〜 #58 を追加 はじめに 日本時間 2012 年 7 月 1 日 9:00 にうるう秒が挿入されましたが、その際 Linux カーネルに起因する不具合により、
#!/bin/bash ########################################################### # このスクリプトの特徴 # # 受信・通過については基本的に破棄し、ホワイトリストで許可するものを指定する。 # 送信については基本的に許可する。ただし、サーバが踏み台になり外部のサーバに迷惑をかける可能性があるので、 # 心配な場合は、送信も受信同様に基本破棄・ホワイトリストで許可するように書き換えると良い。 ########################################################### ########################################################### # 用語の統一 # わかりやすさのためルールとコメントの用語を以下に統一する # ACCEPT :
logrotateは、Apacheのアクセスログや、syslogなど運用の中で肥大化していくログファイルを定期的に退避してくれるツールです。 logrotateの設定は、/etc/logrotate.confファイルにて全てのログファイルに対しての設定を、/etc/logrotate.d/ディレクトリ以下に個別のログファイルごとの設定を記載して管理します。 ※ /etc/logrotated/ディレクトリ以下の個別の設定ファイルに記載した内容は、logrotate.confファイルに設定した内容より 優先度が高くなります。 - /etc/logrotate.confの設定例 # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 10
他に似たツールがあれば教えて欲しいです ロードアベレージを監視して任意のコマンドを実行するコマンド - blog.nomadscafe.jp いままで使ったことはなかったのですが、monit でできるはず、と思って実験。一般的には、負荷が上がったりプロセスが応答しなくなったら再起動、のような用途に使うツールです。 # /etc/monit/monitrc check system localhost start program = "/path/to/command" if loadavg (1min) > 2 then start[追記] exec を使うほうがよいとのご指摘をコメントでいただきました。 check system localhost if loadavg (1min) > 2 then exec "/path/to/command"これでロードアベレージの1分平均が2を超
■はじめに cron とは、ジョブ(スクリプト)を自動実行するためのデーモンプロセスです。そして、Linux システムの管理を行なう場合、ログのローテートや、バックアップなど、定期的に自動実行したいジョブが数多くあります。特に、バックアップなどは、システムへの負荷が大きいため、通常は、ユーザからのアクセスが少ない、深夜や早朝に行なわれます。 このように、定期的に実行されるジョブは、crond というデーモンによって、自動的に行なうように管理することができます。そこで、今回は、cron の設定を行なうために必要なコマンドや、設定ファイルについて説明していきたいと思います。 ■設定手順 このページでは、以下の順番で cronの設定について説明します。 まず、Linuxシステム上で、cron を使用するために、サービスの起動で、サービスの状態を確認し、停止している場合には、サービスを起動します。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く