Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Joe's and working with LXC
Search
O. Ikehara
June 17, 2017
Technology
340
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Joe's and working with LXC
第11回 コンテナ型仮想化の情報交換会@大阪
O. Ikehara
June 17, 2017
Other Decks in Technology
See All in Technology
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
10
3.1k
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
850
自分で立ててみるLLMサービス
y_sera15
0
120
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
140
オンラインゲームのシステム全体像 - コロプラ 2026年度 新卒研修
colopl
0
730
購入ドメインでの課題と取り組み
ykagano
0
140
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
0
120
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
4
1k
freeeらしさをAIとともに作る / Creating the freee Experience with AI
ymrl
0
200
Google Cloud Next Tokyo 26登壇時のスクリプト
recruitengineers
PRO
0
200
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
330
いちAWSエンジニアのAI活用を振り返る #devio2026 / devio osaka 2026 kawahara
masahirokawahara
2
390
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
KATA
mclloyd
PRO
35
16k
Exploring anti-patterns in Rails
aemeredith
4
520
The Mindset for Success: Future Career Progression
greggifford
PRO
0
530
Building a Scalable Design System with Sketch
lauravandoore
464
34k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
350
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
760
Bash Introduction
62gerente
615
220k
sira's awesome portfolio website redesign presentation
elsirapls
0
440
A Soul's Torment
seathinner
8
3.7k
ラッコキーワード サービス紹介資料
rakko
1
5.2M
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Transcript
Joe'sとLXCとその運用実例と June, 17th 2017
2 今日話すこと LXCでサーバー運用するとこんな感じ LXCも意外と面白いんじゃない?
3 Joe's Cloud Computing 設立 2002年7月 資本金 1,000万円 従業員数 11名
代表者 代表取締役社長 田中 邦裕 親会社 さくらインターネット株式会社 所在地 大阪本社 大阪市北区梅田1-11-4-923 大阪駅前第4ビル 9F 銀座オフィス 東京都中央区銀座1-3-3 G1ビル 7F 青山オフィス 東京都港区南青山2-11-13 南青山ビル 4F
4 Joe's Cloud Computing クラウドホスティング事業 – https://www.joeswebhosting.net/ – フルマネージドサービスを中心にインフラ・運用サポートを提供 –
共用サーバー・専用サーバー・VPS(仮想サーバー)・IP分散サーバー
5 Joe's Cloud Computing 国内最大級のSSL証明書販売サービス「Joe’s SSL市場」 – https://joes-ssl.com/ – 主要5ブランドのSSL証明書を40~70%引きで販売
– 申請から取得まで、すべて日本語で対応 – シマンテック・ジオトラスト・グローバルサイン・コモド・セコム
6 Joe's Cloud Computing 経営支援事業 – バーチャルオフィス「Joe’s Business Center」 –
https://www.joes-office.com/ – 月額4,000円から銀座・青山・梅田の一等地に仮想的なオフィスが持てる – 住所利用・郵便物受取(転送)・電話転送・月8時間まで会議室無料
7 Speaker紹介 Osamu Ikehara 1971年産 大阪生まれ大阪育ち 2006年 Joe's入社 サーバーインフラ、カスタマサポート担当 趣味はスキーとか釣りとか 愛車:YZF-R1
'07 twitter : samai fb : https://www.facebook.com/samaiyou
8 Joe'sとLXC 2001年 Scientific Linux6 with kernel 2.6.32.41 +
patch zfs on fuse 当初よりテンプレートを意識した設計 2010年~ ubuntuに乗り換え LXDへの移行模索中
9 Joe'sとLXC 現在 – 共用サーバーの半分がLXC駆動 • リソースの有効活用 • 古いサーバーの統合のため
• cPanelのライセンスがVPSでいける!
10 LXCと仮想サーバー 仮想化の違い – ハイパーバイザー型 • 完全仮想化 – ハードウェアをエミュレーション
• 準仮想化 – システムコールなどをハイパーバイザーが最適化 – コンテナ – hostのプロセスをうまく権限分離して利用
11 LXCとDocker Dockerと何が違うのか – Docker • 基本的にアプリケーションコンテナ • 一度作ったら基本変更しない
– LXC • OSをまるごとコンテナ化 • コンテナ内で作業を行う
12 kvmとの比較 ベンチマーク – kvm kvm xfs qemu 2cpu
1G Dhrystone 2 using register variables 56792694.6 lps (10.0 s, 7 samples) Double-Precision Whetstone 6810.8 MWIPS (10.0 s, 7 samples) Execl Throughput 5672.4 lps (29.9 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 1248151.2 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 338920.3 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 3407075.7 KBps (30.0 s, 2 samples) Pipe Throughput 2262617.5 lps (10.0 s, 7 samples) Pipe-based Context Switching 446836.1 lps (10.0 s, 7 samples) Process Creation 19729.1 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 8706.8 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1099.2 lpm (60.1 s, 2 samples) System Call Overhead 3152446.2 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 56792694.6 4866.6 Double-Precision Whetstone 55.0 6810.8 1238.3 Execl Throughput 43.0 5672.4 1319.2 File Copy 1024 bufsize 2000 maxblocks 3960.0 1248151.2 3151.9 File Copy 256 bufsize 500 maxblocks 1655.0 338920.3 2047.9 File Copy 4096 bufsize 8000 maxblocks 5800.0 3407075.7 5874.3 Pipe Throughput 12440.0 2262617.5 1818.8 Pipe-based Context Switching 4000.0 446836.1 1117.1 Process Creation 126.0 19729.1 1565.8 Shell Scripts (1 concurrent) 42.4 8706.8 2053.5 Shell Scripts (8 concurrent) 6.0 1099.2 1832.1 System Call Overhead 15000.0 3152446.2 2101.6 ======== System Benchmarks Index Score 2105.3
13 kvmとの比較 ベンチマーク – lxc lxc 2cpu 1G memory
Dhrystone 2 using register variables 56862017.1 lps (10.0 s, 7 samples) Double-Precision Whetstone 7563.2 MWIPS (8.4 s, 7 samples) Execl Throughput 8277.0 lps (29.7 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 1079453.4 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 280578.7 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 3060459.2 KBps (30.0 s, 2 samples) Pipe Throughput 2798487.3 lps (10.0 s, 7 samples) Pipe-based Context Switching 440048.3 lps (10.0 s, 7 samples) Process Creation 20450.4 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 9387.7 lpm (60.1 s, 2 samples) Shell Scripts (8 concurrent) 1269.3 lpm (60.2 s, 2 samples) System Call Overhead 2850317.5 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 56862017.1 4872.5 Double-Precision Whetstone 55.0 7563.2 1375.1 Execl Throughput 43.0 8277.0 1924.9 File Copy 1024 bufsize 2000 maxblocks 3960.0 1079453.4 2725.9 File Copy 256 bufsize 500 maxblocks 1655.0 280578.7 1695.3 File Copy 4096 bufsize 8000 maxblocks 5800.0 3060459.2 5276.7 Pipe Throughput 12440.0 2798487.3 2249.6 Pipe-based Context Switching 4000.0 440048.3 1100.1 Process Creation 126.0 20450.4 1623.0 Shell Scripts (1 concurrent) 42.4 9387.7 2214.1 Shell Scripts (8 concurrent) 6.0 1269.3 2115.5 System Call Overhead 15000.0 2850317.5 1900.2 ======== System Benchmarks Index Score 2175.6
14 kvmとの比較 プロセス管理 – kvm libvirt+ 3025 10.8 6.2
8994740 4139096 ? Sl 2017 100573:22 qemu-system-x86_64 -enable-kvm -name server.xxxxxxxxxxxxxxx.com -S -machine pc-i440fx-trusty,accel=kvm,usb=off -m 4096 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 16897bd1-c520-4f31-8673-8955996e2201 -n
15 kvmとの比較 プロセス管理 – lxc root 28021 0.0 0.0
51560 1688 ? Ss Jun06 0:00 lxc-start -n hogehoge root 28040 0.0 0.0 35896 5284 ? Ss Jun06 0:00 \_ /sbin/init root 29750 0.0 0.0 49264 1356 ? Ss Jun06 0:00 \_ /lib/systemd/systemd-udevd --daemon message+ 29853 0.0 0.0 256224 28844 ? Ssl Jun06 0:32 \_ rsyslogd root 29966 0.0 0.0 12776 844 pts/3 Ss+ Jun06 0:00 \_ /sbin/getty -8 38400 tty4 root 29973 0.0 0.0 12780 856 pts/1 Ss+ Jun06 0:00 \_ /sbin/getty -8 38400 tty2 root 29974 0.0 0.0 12780 852 pts/2 Ss+ Jun06 0:00 \_ /sbin/getty -8 38400 tty3 root 29987 0.0 0.0 23648 1036 ? Ss Jun06 0:01 \_ cron root 29994 0.0 0.0 61376 3056 ? Ss Jun06 0:00 \_ /usr/sbin/sshd -D root 30043 0.0 0.0 274448 17340 ? Ss Jun06 0:26 \_ php-fpm: master process (/etc/php5/fpm/php-fpm.conf) 1001 26110 0.4 0.0 283240 36216 ? S 15:13 0:11 | \_ php-fpm: pool www 1001 4828 1.1 0.0 290696 43288 ? S 15:17 0:30 | \_ php-fpm: pool www 1001 10901 0.4 0.0 286024 32992 ? S 15:42 0:05 | \_ php-fpm: pool www 1001 30362 0.0 0.0 12740 444 ? Ss Jun06 0:00 \_ /usr/sbin/fcgiwrap -f root 30400 0.0 0.0 86012 1604 ? Ss Jun06 0:00 \_ nginx: master process /usr/sbin/nginx 1001 30403 0.0 0.0 87164 4420 ? S Jun06 1:05 | \_ nginx: worker process 1001 30404 0.0 0.0 87308 4532 ? S Jun06 1:04 | \_ nginx: worker process 1001 30405 0.0 0.0 87416 4556 ? S Jun06 1:05 | \_ nginx: worker process 1001 30407 0.0 0.0 87164 4404 ? S Jun06 1:02 | \_ nginx: worker process root 13076 0.0 0.0 12640 1736 ? S Jun06 0:00 \_ /bin/bash /usr/bin/mysqld_safe
16 LXC運用のメリット リソース管理がし易い – ダウンタイムの減少 – マネージドの管理がしやすい
17 LXC運用 実際のところJoe'sでどんなLXCの使い方をして いるのか。 – zabbix運用 – 障害対応 –
IPブロック – プロセス管理
18 運用例 さまよえるzabbix 運用テストでLXCでzabbixを作成 – nagiosがごちゃごちゃしすぎてたのでアップ デートが難しかった裏事情 – IPもったいなかったのでNATで設定
# lxc-create -t download -n zabbix –- -d ubuntu -r trusty -a amd64 # lxc-attach -n zabbix apt-get -y install zabbix-server-mysql # iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 10051 -j DNAT --to-destination 10.0.3.218:10051 # iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.0.3.218:443
19 運用例 さまよえるzabbix いい感じなのでどんどん監視対象追加 – テスト運用なので古い遅いマシン – どんどんリソースが足りなくなってきた
じゃあそのまま本番環境に…… – 本番用のちゃんとしたマシンにubuntuを入れて old # lxc-stop -n zabbix old # rsync -av –numeric-ids /var/lib/lxc/zabbix/ newserver:/var/lib/lxc/zabbix/ new # lxc-start -d -n zabbix
20 運用例 さまよえるzabbix 同一ネットワークだと監視の意味が じゃあさくらクラウドに移しちゃえ…… – さくらクラウド2CPU4Gにubuntuを入れて new
# lxc-stop -n zabbix new # rsync -av –numeric-ids /var/lib/lxc/zabbix/ newserver:/var/lib/lxc/zabbix/ sakura # lxc-start -d -n zabbix
21 運用例 障害対応 やばいハードウェア障害が!
22 運用例 障害対応 ヽ(`Д´)ノウワァァァン – MBRが読み込めなかったり – 古いシステムで起動しないとか –
データはあるのにどうしたら
23 運用例 障害対応 起動しなくてもデータが有るのなら – 一旦全部吸い出してLXCで起動しよう! – PXEやUSBのレスキュー環境から –
こんな感じで/からまるごと吸い上げ – rc.sysinitとかrc.localなんかの不要な部分を消し # rsync -av –numeric-ids –exclude=/proc/ --exclude=/sys/ /mnt/resucuedevice/ lxchost:/var/lib/lxc/rescue/rootfs/ # lxc-start -d -n rescue
24 運用例 IPブロック LXCコンテナにアタックが – ipsetとiptables FORWARDチェインでブロック – FORWARDなので失敗しても取り消しやすい
例 ロシアからのsmtpをブロックする # wget http://www.ipdeny.com/ipblocks/data/countries/ru.zone # ipset create BLACKLIST hash:net # for i in `cat ru.zone `;do ipset add BLACKLIST $i;done # iptables -A FORWARD -p tcp -m state --state NEW -m tcp --dport 25 -m set --match-set BLACKLIST src -j DROP
25 運用例 プロセス管理 ホスト側から監視 – htopで見てみる
26 これからのLXCホスティング デプロイ速度の向上 – テンプレートの活用 仮想コンソールの実装 – 簡単に自分のコンテナにアタッチしたい
Migration / HAの実装 まだまだこれから楽しめる分野
27 ご清聴ありがとうございました Any Question?
28 使用したツールとか OSSに感謝 – linux • https://www.kernel.org/ • https://www.ubuntu.com/
– LXC / LXD • https://linuxcontainers.org/ – Unixbench • https://github.com/kdlucas/byte-unixbench.git