目標
- 透過
remote_syslog
將 app log 送到 papertrail 中 - 官方建議的 docker image :
https://github.com/octohost/remote_syslog
- 說明 : https://help.papertrailapp.com/kb/configuration/configuring-centralized-logging-from-docker/#mount
Spare No Effort, Leave No Regret
remote_syslog
將 app log 送到 papertrail 中https://github.com/octohost/remote_syslog
http://facebook.github.io/augmented-traffic-control/docs/install.html
route
查詢sudo atcd --atcd-lan xxxx --atcd-wan xxxx
iw list
,須找到支援 AP 的選項ifconfig -a
,會看到
route
指令檢查 default 的 gateway,可得知 Iface 的名稱,也就是 eth0vim /etc/dhcpcd.conf
interface wlan0
static ip_address=10.0.7.1/24
: 指定 wlan0 的 ip 位置/etc/sysctl.conf
cat /etc/sysctl.conf | grep ip_forward
/etc/sysctl.conf
,找到 net.ipv4.ip_forward
並設定為 1
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-sg-zh_tw-4/s1-firewall-ipt-fwd.html
sudo iptables -F
sudo iptables -F -t nat
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
vim /etc/rc.local
exit 0
之前,加入sudo iptables-save > /etc/network/iptables.ipv4.nat
sudo iptables -t nat -S
sudo iptables -S
sudo iptables -L
sudo apt-get -y install dnsmasq
sudo vim /etc/dnsmasq.conf
,在最下方編輯
1 |
|
sudo systemctl restart dnsmasq && sudo systemctl enable dnsmasq
sudo apt-get install hostapd -y
cp /usr/share/doc/hostapd/examples/hostapd.conf.gz /etc/hostapd/
gunzip /usr/share/doc/hostapd/examples/hostapd.conf.gz
interface=wlan0
driver=nl80211
ssid=RPI-AP
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=12345678
: 設定無線網路密碼wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
sudo hostapd -dd /etc/hostapd/hostapd.conf
iptables -L
sudo sed -i 's/#DAEMON_CONF=""/DAEMON_CONF="\/etc\/hostapd\/hostapd.conf"/g' /etc/default/hostapd
sudo systemctl enable hostapd && sudo reboot
/var/log/syslog
sudo systemctl hostapd stop
/docker-entrypoint-initdb.d/
底下的 sql 指令,就會自動建立好預設的 database & table1 |
|
1 |
|
docker exec some-mariadb mysql -u root --password=1234 --database=test -e "show tables;"
aws ecr get-login --no-include-email --region us-east-1
: 取得 docker login -u AWS -p ....
docker build -t xxx {image}
docker tag xxx your-ecr-position/your-repo-name:latest
docker push your-ecr-position/your-repo-name:latest
Dockerrun.aws.json
envsubst
可善用此指令cd folder && zip -r $folder.zip ./ && aws s3 cp $folder.zip s3://{bucket_name}/{folder.zip}
1 |
|
1 |
|
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
http://docs.aws.amazon.com/cli/latest/index.html
aws help
: 可看到所有指令aws help
aws {command} help
aws {command} {sub-cmd} help
http://docs.aws.amazon.com/cli/latest/userguide/cli-command-completion.html
echo $SHELL
which aws_completer
complete -C '/usr/local/bin/aws_completer' aws
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
aws configure help
: 查詢在 configure 中的指令有哪些可用aws configure
aws configure --profile user2
aws configure list
: 預設aws configure list --profile default
: 指定身份aws ec2 describe-instance
aws ec2 describe-instance --profile user2
export AWS_PROFILE=user2
: AWS_PROFILE 為 Environment Variablesunset AWS_PROFILE
: 回到預設值--profile
: 指定使用 profile--region
: 指定地區
aws ec2 describe-regions --output table
--output : json |
text | table |
--endpoint-url
: 指定aws ec2 describe-instances --output table --region ap-northeast-2
aws configure list
export AWS_PROFILE=xxx
unset AWS_PROFILE
logsx.papertrailapp.com:46888
1 |
|
docker exec -it [container_id] /bin/bash
journald
, json-file
1 |
|
apt-get update
wget {download source}
dpkg -i {download file}
su ejabberd && cd ~
vi ./conf/ejabberd.yml
./bin/ejabberdctl start
./bin/ejabberdctl register admin {host} admin
apt-get install cvs make gcc libexpat1-dev libncurses5-dev libssl-dev bison byacc flex -y
cvs -z3 -d:pserver:anonymous@jabbertest.cvs.sourceforge.net:/cvsroot/jabbertest co testsuite
cd testsuite/ && cp Makefile.linux Makefile && make userreg
./userreg -?
的使用方法./userreg -h 127.0.0.1 -u 3000 -n 1 -o ./output
cat ./output
如果成功會顯示類似,無意外會有 3000 筆資訊ejabberd stop
then start
wget http://www.ejabberd.im/files/other/jabsimul.tar.gz
tar xzf jabsimul.tar.gz
cp jab_simul.xml.example jab_simul.xml
./configure && make
jab_simul.xml
: 參考 http://tkabber.jabber.ru/files/badlop/jab_simul.xml.chat60
jab_simul.xml
中,server 的位置,必須是可解析的 DNS,不能用 ip./jab_simul
jab_simul
執行後的錯誤訊息
Socket creation error ! (Too many open files)
: 請調整 ulimit 參考其他參數調整Segmentation fault (core dumped)
: 伺服器超載如果要模擬 2000 個用戶,在同一台機上上進行壓力測試,必須設定限制高於 4000 以上
shaper 是設定查詢允許的流量速度…應該被受限在硬體的效能上…
在 ejabberdctl.cfg 中,可設定 ERL_MAX_PORTS & ERL_MAX_ETS_TABLES
什麼是 ETS => Erlang Term Storage 什麼是 DETS => Disk Erlang Term Storage
free -k
free -k
在 t2.micro 底下約 7500 人,同時在線
1 |
|
當使用越來越多的工具時,有時新版的 release 來不及跟上,變成版本落差極大,透過 slack rss bot 的幫忙,當 release 有更新時,透過 msg 通知
.atom
即可。ex: https://github.com/xxxx/yyyy/releases.atom