事先安裝好Node.js和CollectD
第二步是將下述command, 寫成單一的.sh檔案, 即可安裝
###
### Install StatsD ###
###
PARENT_LOCATION="/opt/nodejs"
### Download StatsD ###
cd /usr/local/src
sudo git clone https://github.com/etsy/statsd.git
sudo mv statsd $PARENT_LOCATION/
sudo cp $PARENT_LOCATION/statsd/exampleConfig.js $PARENT_LOCATION/statsd/config.js
### Install node-supervisor ###
#sudo npm install supervisor -g
### Install Supervisord ###
sudo rpm -Uhv https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum -y install supervisor
sudo chkconfig supervisord on
sudo chmod 600 /etc/supervisord.conf
### Configure Supervisord ###
sudo cat statsd.init >> /etc/supervisord.conf
sudo mkdir -p /var/log/nodejs
sudo rm -f statsd.init
###
### Run StatsD ###
###
sudo service supervisord restart
#############
[statsd.init]
[program:nodejs_statsd]
command = /usr/local/bin/node /opt/nodejs/statsd/stats.js /opt/nodejs/statsd/config.js
directory = /opt/nodejs/statsd
user = root
autostart = true
autorestart = true
environment = NODE_ENV="production"
logfile=/var/log/nodejs/statsd.log
logfile_maxbytes=20MB
logfile_backups=10
沒有留言:
張貼留言