AWS 雑多なメモ: Difference between revisions

From misc notes
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
*謎なメモ
*謎なメモ
  munin, munin-node, logstash-forwarder(conf,crt,key), kibana-int, monit
  munin, munin-node, logstash-forwarder(conf,crt,key), kibana-int, monit, zimbra





Revision as of 09:00, 12 June 2015

  • 謎なメモ
munin, munin-node, logstash-forwarder(conf,crt,key), kibana-int, monit, zimbra


  • 時刻が意外とズレる
cat /sys/devices/system/clocksource/clocksource0/available_clocksource
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
echo tsc > /sys/devices/system/clocksource/clocksource0/current_clocksource
私は ntpd は使わず cron で ntpdate して様子見中...結局 ntpd 上げた。
関連ありそうな kernel option の clocksource=tsc highres=off nohz=off divider=10 をいろいろ調査中 (とりあえず何も付けないに10点)
clocksource=tsc を有効にするには、highres=off nohz=off が必要。
nohz=off にすると、timer 割り込みが増えて、cpu load が上がる。


  • Broken PMTUD on Amazon EC2

あら... Broken PMTUD on Amazon EC2

ec2-authorize default -P icmp -t 3:4

Management Console では

Cuntom ICMP rule
Type : Destination Unreachable
Code : fragmentation required, and DF flag set


  • 気になったのでメモっておく tso 問題

Q: さくらのVPSで「Ubuntu」を利用していますが、回線速度が遅くアクセスに時間がかかります。

ec2 でも何かあるのかは調査中。いまのところはメモのみ

sudo aptitude install ethtool
sudo ethtool -k eth0
sudo ethtool -K eth0 tso off


/etc/network/interfaces に追加

post-up /sbin/ethtool -K eth0 sg off
post-up /sbin/ethtool -K eth0 tso off
  • delete on termination の確認方法

AWS Management Console で block device mapping が pop-up させるようになったんだが、どうも delete on termination の表示が違う気がするので確認してみた。

ec2-describe-instance-attribute i-XXXXXXXX -b -v
これ出力されるレスポンスの中で、<blockDeviceMapping> の配下の <deleteOnTermination> で確認
  • たんなるメモ
EBS Backed instance で
stop
boot volume detach
other bootable volume attach
start
EBS Backed instance で
create AMI
AMIが保持する snapshot から EBS volume 作成
volume attach
rsync
detach
snapshot
  • EC2 で munin

/etc/munin/munin-node に追加

[iostat]
env.SHOW_NUMBERED 1

iostat_ios を変更

#return 0 if ($tmpnam =~ /^\s*(?:sd|hd)[a-z]\d+\s*$/);
  • たんなるメモ

Ubuntu 10.04 LTS (Lucid Lynx) AMI

dpkg-reconfigure tzdata
aptitude update
aptitude safe-upgrade -y

apt-get install mysql-server
apt-get install wordpress-l10n

apt-get install emacs22-nox
apt-get install sysstat
apt-get install mysqltuner
/etc/sysctl.d/60-my-tunings.conf
vm.swappiness=0
net.ipv4.tcp_fin_timeout=3
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
  • 軽い screen
http://dtach.sourceforge.net/
いいかも
  • メール送信制限に関する通知
Amazonからメール送信制限に関するEC2 Account Notificationが来た | Shin x blog
ヘー メールの outbound もしっかり監視してるんだ...
  • aki だけで ari が不要な ami もある
kernel が OK なら、initrd 不要
  • ELB で SSL + Multiple Domains
Use ELB to Serve Multiple SSL Domains on One EC2 Instance
Using ELB to Serve Multiple Domains Over SSL on EC2 for Giggles and Unicorns « elwoodicious
  • EBS root で instance store を使う
How to use instance store on EBS-backed m1.small?
-b /dev/sdc=emphemeral0
  • instance type の 変更方法
EBS root の場合、instance を stop して、ec2-modify-instance-attribute で instance type を変更して、再度、start させるとよい。
Move a Running EBS Boot Instance to New Hardware on Amazon EC2 - Alestic.com
This above process can also be used when your instance is running fine, but you want to move to
a different instance type (size) of the same architecture. For example, you could move from
m1.small up to c1.medium, or from m2.4xlarge down to c1.xlarge. Update: I wasn’t thinking
clearly when I wrote that last sentence. It is possible to change the instance type much more
easily: Simply stop the instance, use ec2-modify-instance-attributes, and start it up again.
  • instance 起動時のトラブル
どうも、新しく Instance を起動する場合、Network が生きるのが遅いような気がする。
一度起動して、reboot する場合は、問題無し。
要調査
  • リモート運用のメモ2
TCPKeepAlive
ServerAliveInterval 15
ServerAliveCountMax 3
man ssh_config
NAT環境で放置したSSH接続が切れる問題への対処
  • リモート運用のメモ1
EC2はリモートにあるので、アクセス回線断に困らないように screen を使う癖をつける事 > 自分
.screenrc
defutf8 on
defkanji utf-8
encoding utf-8 utf-8
defencoding utf-8
#
vbell off
autodetach on
startup_message off
altscreen on
# for Emacsian
escape  ^Tt
#
defhstatus "^En:^Et"
hardstatus on
hardstatus alwayslastline "screen |%c %m/%d | %w"
# for Macintosh delete key
bindkey -k kD stuff \177
# for MacOSX Terminal.app enable scroll
termcapinfo xterm* ti@:te@
# avoid dangerous key bind
bind x
bind ^x
bind k
bind ^k
bind .
bind ^\
bind \\
bind ^h
bind h
.bash_login
if [ $TERM != "screen"  ]; then
    exec screen -xRR
fi
exit ではなく detach する事 > 自分
  • boot from EBS での ephemeral stores の使用
Amazon Web Services Developer Community : local instance storage on ebs booted ...
メモメモ
  • Region 間の移動メモ
Amazon EC2のイメージ(AMI)をus-eastからus-westにコピーする方法 : Media Technology Labs (MTL) : メディアテクノロジーラボ ブログ
AMIこれで行くのね。EBSはどうしたら効率的に移動できるのかなぁ...(データ転送利用料をミニマムで)
  • boot from EBS 雑多なメモ
Create EBS Boot AMI
2 scripts that can be used to create an bootable EBS from a running instance. ami-4205e72b created with this process
ec2-register --snapshot snap-xxxxxxxx --kernel aki-xxxxxxxx --ramdisk ari-xxxxxxxx --description="EBS Ubuntu Hardy" --name="ebs-ubuntu-hardy-8.04-i386-server-20109999" --architecture i386 --root-device-name /dev/sda1
ほう Root Device Type ebs では Instance Lifecycle に stop と start が追加されてるのね。
              - '<delete-on-termination>': indicates whether the Amazon EBS
               volume should be deleted on instance termination. If not
               specified, this will default to 'true' and the volume will be
               deleted.
それで、default が true なのか...
ebs volume ごと消したければ、明示的に Terminate しろということか
shutdown -h now だけでは、stop になるだけ。
  • Ubuntu on EC2 ec2-tools PPA
Ubuntu 用の ec2-api, ec2-ami tools の最新版リポジトリ
deb http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/ubuntu hardy main
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9EE6D873
  • Amazon S3 support for Versioning
Amazon Web Services Developer Community : Amazon S3 support for Versioning ...
うまい戦略ですね...
  • Ubuntu One
Ubuntu One : Home
って S3 つかってるんですね。
  • Amazon Relational Database Service (Amazon RDS)
Amazon Relational Database Service (Amazon RDS)
あらら "What Amazon is introducing today is slightly different than what most people might have expected, it’s really MySQL5.1 as a service." (RightScale blog より)
フルマネージド MySQL という立て付けなのね...
  • Lower Amazon EC2 Instance Pricing
Announcing Lower Amazon EC2 Instance Pricing
うれしい☆
  • Amazon EC2 High-Memory Instances
Announcing Amazon EC2 High-Memory Instances
  • Auto Scaling groups can now span multiple availability zones
Amazon Web Services Developer Community : Auto Scaling groups can now span multiple availability zones
すばらしい。
  • EC2 Instance IP Black Listed at spamhaus.org
Amazon Web Services Developer Community : EC2 Instance IP Black Listed at ...
"Reputation Fate Sharing" 問題ですな。
とはいえ、まだ RBL つかってるんですか????
  • Amazon EBS Shared Snapshots
Introducing Amazon EBS Shared Snapshots
shared AMI + shared EBS でうれしさ倍増
  • AWS Solution Providers Program
Solution Providers Program
RackSpace Cloud Tools の地味なヤツ (この地味さがAWSの良さかもしれず)
  • AWS Access Credential Rotation
Amazon Web Services Blog: AWS Access Credential Rotation
Access Key の 差し替えを簡単に。
管理者がヤンゴトナキ事情で交代する場合に便利 ;)
  • Cloud 系なんでもかんでも OSS 落ち穂拾いプロジェクト
hail cloud computing project - hail is a cloud computing umbrella project for several inter-related projects
RedHat 肝いりのプロジェクトです
ヲチしましょう。
  • 公式 日本語コンテンツ
Amazon CloudFront > Information in Japanese
へぇ CloudFront には日本語のページがあるのね
  • AWS 多要素認証
Multi-Factor Authentication
  • AWS Management Console で CloudWatch サポート
AWS Management Console - Now with Amazon CloudWatch Support
あそんでみるか
  • Amazon Virtual Private Cloud (VPC)
Introducing Amazon Virtual Private Cloud (VPC)
うーむ うーむ うーむ
  • Reserved Instances が値下げ
Announcing Amazon EC2 Reserved Instances
うーむ もう一声ほしいなぁ (おとーさんの小遣いからの出費[一時出費ではあるが]ではつらい)
(もちろんランニングコストは1/3になるんだが...)
  • こっちにメモ
Ten observations about cloud computing | The Pervasive Datacenter - CNET News
Ten things I learned while writing Cloud Computing for Dummies « Judith Hurwitz’s Weblog
  • AWS blog より二題 (もはや惰性)
Pig Latin - High Level Data Processing with Elastic MapReduce
Adding the Export to AWS Import/Export
すご...
  • わははすごい libcloud a unified interface to the cloud
libcloud python library - a unified interface cloud server providers
統一 API ごにょごにょやるよりも実践!
  • Rackspace Cloud APIs が Creative Commons 3.0 で公開
Rackspace goes Open Source with API's
カンブリア爆発的な時期ですなぁ
  • Notice: Degraded Amazon EC2 Instance
Recover data from "Degraded Amazon EC2 Instance"?
へー こんなメールがくるんだ ;)
  • Rackspace Cloud 1.0 for iPhone
http://www.appleiphoneschool.com/2009/07/22/rackspace-cloud-10-for-iphone/
あはは、早いなぁ
  • Amazon EC2 Zone Reaches Capacity???
Cloud Computing Part 1 – Amazon EC2 Zone Reaches Capacity | Wire Turf
無限という事は無いわけで...
  • Rackspace Cloud 加速中
Cloudkick now supports Rackspace Cloud Servers
RightScaleも対応してるし、RESTful な API も公開したし
  • これは秀逸:)
YouTube - Cloud Wars
おいしいキーワード満載:)
(追記)
BEZOS : Jeff bezos - Amazon CEO
LORD WERNER : Werner Vogels [@werner] Amazon CTO http://www.allthingsdistributed.com/
Thorsten SKYWALKER : Thorsten Eicken, RightScale CTO 
RUV : Reuven Cohen [@ruv] Enomaly CTO http://www.elasticvapor.com/
the Red Monk, COTE : Michael Coté [@cote] RedMonk http://www.redmonk.com/cote/ http://www.redmonk.com/cote/it-management-podcast/
BOTCHAGALUPE : John Willis [@botchagalupe] http://www.johnmwillis.com/ http://www.johnmwillis.com/best-of/
URQUHART : James Urquhart [@jamesurquhart] http://blog.jamesurquhart.com/
PERRY : Geva Perry [@gevaperry] http://gevaperry.typepad.com/ http://overcast.typepad.com/overcast/
the GREAT LINTHICUM : David S. Linthicum [@davidlinthicum] http://davelinthicum.blogspot.com/ http://feeds.feedburner.com/CloudComputingPodcast


  • Mosso is now the Rackspace Cloud!
From Mosso To The Rackspace Cloud
Cloud Computing, Cloud Hosting & Online Storage by Rackspace Hosting. Mosso is now the Rackspace Cloud.
  • Amazon's EC2 vs Mosso
Cloud servers for your Perl app - Amazon's EC2 vs Mosso - Catalyzed.org: A Catalyst and Perl Blog
バランス・バランス :)
(追記)
mon petit blogue sans importance... - A look at rackspacecloud.com vs AWS (updated)
  • Reserved Instance 適用タイミング
Cloud Developer Tips: EC2 Reserved Instance Billing Gotcha
次の月次請求タイミングかららしい
  • RackSpaceでも一部の区画が停電
Data center update as of 8:58 pm CST
Mossoにも影響があったようだ
Cloud Sites | DFW | Online
ふぅぅぅぅぅ
ひと月の間に3回もっていってるユーザがいるな。IDCの電源周りの不備なんだろうなぁ。すぐには替えられないような...
(追記)
Dallas data center update as of 11:26 pm CST(link消滅)
電源設備の容量不足???
(さらに追記)
Dallas Data Center Update
INCIDENT REPORT - GRAPEVINE, DFW POWER INTERRUPTION - June, 29 2009
商用電源停止中に発電機が障がいをおこし停止した。
電源周波数の同期回路に問題か。ありがちだなぁ
(しかし、RackSpaceの情報開示のレベルは賞賛に値すると思う。さすが、Fanatical Support® !!!)
(またまた追記)
The Day After: A Brutal Week for Uptime « Data Center Knowledge
厄週間か...
(またまたまた追記)
Someone Needs To Stop Tripping Over The Power Cord At Rackspace
また DFW で電源断...
  • Open Federated Clouds
SUN は SUN であってほしいなぁ
Open Federated Clouds And Sun’s Cloud Announcement | CloudAve
Sun Rethinking Its Cloud Strategy? | CloudAve
  • もう実用化の段階ですね (それにくらべて...)
ハイブリッド型のクラウドでババン
Rackspace lays out its cloud computing roadmap: Think hybrid
AWSの独占の気配をうけて、最近はみな Mosso を持ち上げてますね。(バランス感覚すごいです)
  • 落雷で一部のインスタンスが停止
Lightning Strike Triggers Amazon EC2 Outage
うーむ インフラ屋は大変だなぁ しみじみ...
  • AWS Security Center
AWS Security Center
RADLab Above the Clouds の "Data Confidentiality and Auditability" に回答中... AWS気合いはいってるなぁ
  • Mosso も API 公開するのね
The Rackspace Cloud Invites Feedback on Upcoming Cloud Servers API
  • EC2 での /etc/hosts と hostname
debian, ubuntu 方面で厳密化している localhost と hostname の扱いを考えると、EC2 の プライベート IP アドレス空間での /etc/hosts は Canonical 版 ubuntu ami の /usr/sbin/ec2-set-hostname で設定しているやりかたが妥当な所かな
127.0.0.1 localhost
127.0.1.1 AMIのlocal-hostname(AMI instance Metadata から取得)

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
また、hostname は hostname --fqdn で取得したホスト名を DNS を引けば、現在の ローカル IP アドレス を引けるものを設定する事。つまり、AMIのlocal-hostname(AMI instance Metadata から取得)を hostname とする。
  • ec2-bundle-vol で -e /tmp,/opt したら
/opt が消えたし、/tmp の 権限で失敗 (あたりまえか)
mkdir /opt
chmod 1777 /tmp
  • EC2の public FQDN を EC2内部で引くと
おもしろい、private IP address が返ってくる。
深い意味があるなぁ
Instance Addressing Concepts
(追記) Elastic IP の AWSから割り当てられる外部DNS名も、EC2内部でひけば、private IP address がかえってくるので、必ず同一の Elastic IP を割り当てるのなら、簡単にインスタンス間でひも付けができる。
Using Elastic IP to Identify Internal Instances on Amazon EC2
  • また出た! AWS Import/Export for Physical Data Transfer
RADLab Above the Clouds の "Data transfer bottlenecks" という指摘に素早く対応した。やるなぁ AWS
AWS Import/Export
  • 出た! Amazon CloudWatch, Elastic Load Balancing, Auto Scaling,
AWS最強ですな。これで価格がもう少し下がったら、恐ろしいことになるなぁ。(まだチョイと高めな印象ですね)
Amazon CloudWatch Developer Guide
Elastic Load Balancing Developer Guide
Auto Scaling Developer Guide
Amazon EC2 API Tools version 2009-05-15
Amazon CloudWatch API Tools
Elastic Load Balancing API Tools
Auto Scaling API Tools
  • Eucalyptus が商用化
4月29日に550万ドル調達して事業化らしい。
すげ
Ubuntu採用オープンソースクラウド「Eucalyptus」を専門とする企業が発足
Eucalyptus Systems Inc
Eucalyptus Systems raises $5.5M for a hybrid approach to cloud computing » VentureBeat
  • Security Groupsうんぬん
amiによったら、デフォルトやばいのあるのかしら...
当たり前のことを当たり前にやっておく事だねぃ
Tips for Securing Your EC2 Instance
ec2-authorize
得難いレポート:)
非常事態宣言!! Amazon EC2、ホームページが消えました【 横浜のホームページ制作|スタジオFIXの社長ブログ 】
まぁ
PasswordAuthentication no
は、確認しておく事
(追記)

tcpwrapper された sshd なら(たいていそうなっている) /etc/hosts.allow で制限しておく事

sshd : 127.0.0.1 あなたがアクセスするIPアドレス もしくはドメイン名(たとえば .e-mobile.ne.jp) : allow
sshd : ALL : deny

ALL : localhost 127.0.0.1 : allow
ALL : [::1] : allow
  • EC2 で リモートデスクトップ
Running an X desktop with VNC on Ubuntu on Amazon EC2
のところ、NX がいいぞと
New AMI in development: Ubuntu 7.10 Gutsy desktop AMI with NoMachine NX Free Server
NoMachine NX
EC2 で ubuntu の DeskTop 版を NX で使ってみたけど、反応が重いなりにつかえた。
  • user dataあたりを調査厨
ec2-run-instances
Instance Metadata
  • sysctl.conf はこんな程度でいいかな
# tuning for Amazon EC2 m1.small instance
#
# uncomment, if you want.
#vm.swappiness=0
#
#kernel.random.poolsize = 2048
kernel.sem = 250 32000 128 1024
kernel.msgmni = 256
#kernel.shmmax=268435456
#kernel.shmmax=2147483648
#
net.ipv4.tcp_rmem = 4096 4194304 4194304
net.ipv4.tcp_wmem = 98304 4194304 4194304
net.ipv4.tcp_mem = 162624 4194304 4194304
net.core.rmem_default = 262144 
net.core.wmem_default = 262144 
net.core.rmem_max = 4194304 
net.core.wmem_max = 4194304 
#
net.ipv4.tcp_max_syn_backlog = 2500
net.core.somaxconn = 4096
#net.ipv4.tcp_max_orphans = 32768
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
  • 時々勝手に reboot しちゃうなぁ
インスタンスを立ち上げて、まもなく勝手にリブートする場合があるなぁ...
Elastic IP 割り当ててしばらくしてからかなぁ...
まったくこういった事象に遭遇しないインスタンスもあるなぁ...
ヲチしよう...
  • たんなるメモ
dpkg-reconfigure tzdata
apt-get update
apt-get upgrade
apt-get autoremove
apt-get install rcconf
apt-get install sysv-rc-conf
#apt-get install acct
apt-get install screen
apt-get install traceroute
apt-get install unzip
apt-get install emacs22-nox
apt-get install ddskk
apt-get install skkdic
apt-get install nkf
apt-get install python-boto
/etc/bashrc
/etc/sysctl.conf
/etc/rc.local
/etc/ssh/sshd_config
UseDNS no
/etc/hosts.allow