172173.com

系统更新

1
2
3
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

安装 zookeeper

1
2
3
4
5
6
7
wget http://apache.fayea.com/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

tar xf zookeeper-3.4.10.tar.gz -C /usr/local
cd /usr/local/zookeeper-3.4.10/conf
cp -pv zoo_sample.cfg zoo.cfg
vim /usr/local/zookeeper/conf/zoo.cfg
mkdir -p /data/zookeeper

安装 kafka

1
2
3
4
5
6
7
wget http://www-eu.apache.org/dist/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz
tar xf kafka_2.12-0.10.2.1.tgz -C /usr/local
cd /usr/local && ln -s kafka_2.12-0.10.2.1 kafka

vim /usr/local/kafka/config/server.properties

nohup bin/kafka-server-start.sh config/server.properties &

安装 supervisor 守护进程

1
2
3
4
5
6
7
8
9
10
python get-pip.py 
pip install setuptools
pip install -U setuptools
pip install supervisor
echo_supervisord_conf > /etc/supervisord.conf
mkdir /etc/supervisor
sed -i 's#\;\[include\]#\[include\]#' /etc/supervisord.conf
sed -i '/relative\/directory/a\files = /etc/supervisor/*.ini' /etc/supervisord.conf
mkdir /data/httplogs
supervisord -c /etc/supervisord.conf

kafka 启动

1
2
./kafka-console-producer.sh --broker-list 10.10.32.92:9092  --topic log
./kafka-topics.sh --create --zookeeper 10.10.32.92:2181 --replication-factor 1 --partitions 1 --topic log

swap 关闭

1
2
3
echo "vm.swappiness = 1" >> /etc/sysctl.conf
sysctl vm.swappiness=1
swapoff -a && swapon -a

安装 elasticsearch

1
2
3
4
5
6
7
8
9
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-http
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
sudo apt-get update && sudo apt-get install elasticsearch
cp -pv /etc/elasticsearch/elasticsearch.yml{,.default}
vim /etc/elasticsearch/elasticsearch.yml
mkdir -m 755 -p /data/elasticsearch/{elasticsearch_logs,elasticsearch_data}
chown -R elasticsearch:elasticsearch /data/elasticsearch
/etc/init.d/elasticsearch start

安装 node

1
2
3
4
5
wget https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz
tar xvf node-v6.11.2-linux-x64.tar.xz
mv node-v6.11.2-linux-x64 /usr/local/
cd /usr/local/ && ln -s node-v6.11.2-linux-x64/ node
chown root:root -R node-v6.11.2-linux-x64/

 评论