- 多数软件都在
/root/project/codebase/3rdpart
- redhat7用firewalld取代了iptables,遇到问题请添加redhat7关键字搜索,详情请参见Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7
- 时区问题:起因是cron任务总不执行,然后发现时区不对,印象中安装os的时候会让选timezone的,可能是批量安装英文版会出这个问题?几个常见的时区如下:
- UTC: Coordinated Universal Time,协调世界时,由原子钟提供
- GMT: Greenwich Mean Time,格林尼治标准时间(本初子午线)
- EDT: Easten Daylight Time,美国东部夏令时(UTC-4)
- CST: Central Saving Time,美国中部夏令时(UTC-6)
-
Asia/Shanghai: UTC+8
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
/sbin/hwclock --systohc
systemctl restart crond.service
systemctl | grep cron
- 系统结构图:
机器列表
- uat:
- linux redhat7.1, 内核3.10.0-327.el7.x86_64, 8核32G 1T硬盘
- windows 2008 R2 sp1, 4核16G 500G硬盘
- prod:
基础软件
-
jdk8:
yum install jdk-8u73-linux-x64.rpm
java -version -
anaconda2:
yum install bzip2
./Anaconda2-4.2.0-Linux-x86_64.sh
which python
python -V -
nginx-1.8.0:
cp -r nginx-1.8.0 /root/
yum install gcc gcc-c++ ...
./configure & make & make install
默认安装到/usr/local/nginx, 配置请参见cat-web/static/nginxconfig/nginx.conf
vi /usr/local/nginx/conf/nginx.conf
:%s/172.16.*/172.17.*/g
Permission denied
user nobody -> user root
/usr/local/nginx/sbin/nginx // 启动 -
mongodb-3.2.1: 通过robomongo查看
cp -r mongodb-linux-x86_64-rhel62-3.2.1 /root/
bin/mongod --logpath /var/log/mongo.log --logappend // 可加入supervisor统一管理 -
influxdb-1.2.4: 通过8083查看web console
yum install influxdb-1.2.4.x86_64.rpm
./influxd // 启动,可加入supervisor统一管理
// 启用web界面
vi /etc/influxdb/influxdb.conf
[admin]
enabled = true -
activemq-5.10.0: 通过8161等端口查看web console
tar -xzf apache-activemq-5.10.0-bin.tar.gz -C /root/activemq/
每个amq实例要添加对应的activemq-{appName}.xml和jetty-{appName}.xml,修改对应的端口号
bin/activemq start
加入supervisor的话不能直接用activemq start,而要用start之后实际的java命令 -
supervisor-3.1.3: 通过9001查看web console
mkdir /root/supervisor
cp -r setuptools-16.0 meld3-0.6.5 elementree-1.2.6-20050316 supervisor-3.1.3 /root/supervisor/
依次在setuptools-16.0, meld3-0.6.5, elementree-1.2.6-20050316, supervisor-3.1.3目录下执行
python setup.py install
supervisord
supervisorctl status
连localhost报错
vi /etc/supervisor.conf
[inet_http_server]
port=0.0.0.0:9001
local, dev里可以考虑将若干项目合并到1个group里,便于管理。uat, prod里酌情考虑
[group:cat]
programs=cat1,cat2,cat3
对每个要监控的进程添加conf
supervisorctl update
内部依赖
- engine:
- web:
-
添加定时任务:
pip install pymssql*.whl --no-index
pip install pymongo*.whl --no-index
crontab -e
// 同步wind的贵金属期货+现货Ref,修改wind的配置信息
39 8 * * * /root/anaconda2/bin/python /root/project/jenkins/cat/qa/cat-web/bin/cronWindFutureRef.py
// backup mongo
0 22 * * 1,2,3,4,5 bin/mongodump -h host_ip -d database_name -o /data/db
// 定时重启进程,每天,晚上有行情,不做夜盘
30 15 * * 1,2,3,4,5 /root/anaconda2/bin/supervisorctl stop cat mongo-master influx
30 8 * * 1,2,3,4,5 /root/anaconda2/bin/supervisorctl start cat mongo-master influx
// 定时清理log,每周,暂时不用做,先把log整理一下,输出有用的
0 22 * * 6 rm -f /root/project/log/*.log*
外部依赖
- 行情网关:
- 交易网关:
-
Account:
unzip qi4trade-account.zip
java -jar -Denv=uat /root/qi4trade-account/server/target/account-server-1.0.0-SNAPSHOT-jar-with-dependencies.jar - 常用的查看地址:
- mongodb用Robomongo 1.0.0查看:localhost/strategy-web-dev
- influxdb存时间序列:http://localhost:8083
- amq:http://localhost:8161/admin/topics.jsp