关闭防火墙、selinux

更换阿里云 yum源

依赖环境

yum install -y epel-release
yum install vim net-tools nmon htop rsync tree ntp iftop wget clamav -y

安装easy_install

cd /tools
[root@jason tools]# wget --no-check-certificate https://pypi.python.org/packages/f7/94/eee867605a99ac113c4108534ad7c292ed48bf1d06dfe7b63daa51e49987/setuptools-28.0.0.tar.gz#md5=9b23df90e1510c7353a5cf07873dcd22
[root@jason tools]# tar -xzvf setuptools-28.0.0.tar.gz
[root@jason tools]#cd setuptools-28.0.0
[root@jason tools]#python setup.py install

安装pip

# wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz -O pip-1.5.5.tar.gz
# tar -xzvf pip-1.5.5.tar.gz
# cd pip-1.5.5/
# python setup.py install
# pip install -U pip

安装模块

依赖环境

yum install -y mysql-devel python-devel

# cd /mnt/
# git clone https://github.com/welliamcao/OpsManage.git
# cd /mnt/OpsManage/
#vim requirements.txt
将Django版本改为1.8.17
# pip install -r requirements.txt
pip install paramiko

 

安装Redis

# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
# tar -xzvf redis-3.2.8.tar.gz
# cd redis-3.2.8
# make
# make install
# vim redis.conf

修改以下配置

daemonize yes #128行

loglevel warning #158行
logfile "/var/log/redis.log" #163行
bind 你的服务器ip地址 #61行
例如: bind 127.0.0.1 192.168.88.201

# cd ../
# mv redis-3.2.8 /usr/local/redis
# /usr/local/redis/src/redis-server /usr/local/redis/redis.conf

开机自启

将/usr/local/redis/src/redis-server /usr/local/redis/redis.conf加入到/etc/rc.d/rc.local

安装mysql

配置文件添加

[root@jason ~]# cat /etc/my.cnf |grep -Ev '^%|^$'
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
character_set_server = utf8
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' ##添加
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 创建数据库opsmanage ,并赋予全部权限

# mysql -uroot -p
mysql> create database opsmanage DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> grant all privileges on opsmanage.* to root@'%' identified by 'jason_zhang';
mysql> FLUSH PRIVILEGES;

 配置OpsManage

[root@jason ~]# cd /mnt/OpsManage/
[root@jason OpsManage]# cd OpsManage/
[root@jason OpsManage]# cat settings.py |grep -Ev '^%|^$'
#!/usr/bin/env python
# _#_ coding:utf- _*_
"""
Django settings for OpsManage project.
Generated by 'django-admin startproject' using Django 1.9..
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import djcelery
from celery import platforms
from kombu import Queue,Exchange
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
''' celery config '''
djcelery.setup_loader()
BROKER_URL = 'redis://192.168.199.224:6379/4' ##redis的IP、端口和库
CELERY_RESULT_BACKEND = 'djcelery.backends.database.DatabaseBackend'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER='pickle'
CELERY_ACCEPT_CONTENT = ['pickle','json']
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_TASK_RESULT_EXPIRES = * *
CELERYD_MAX_TASKS_PER_CHILD =
CELERY_TRACK_STARTED = True
CELERY_ENABLE_UTC = False
CELERY_TIMEZONE='Asia/Shanghai'
platforms.C_FORCE_ROOT = True
#celery route config
CELERY_IMPORTS = ("OpsManage.tasks.assets","OpsManage.tasks.ansible",
"OpsManage.tasks.cron","OpsManage.tasks.deploy",
"OpsManage.tasks.sql","OpsManage.tasks.sched")
CELERY_QUEUES = (
Queue('default',Exchange('default'),routing_key='default'),
Queue('ansible',Exchange('ansible'),routing_key='ansible'),
)
CELERY_ROUTES = {
'OpsManage.tasks.sql.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.assets.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.cron.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.sched.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.ansible.AnsibleScripts':{'queue':'ansible','routing_key':'ansible'},
'OpsManage.tasks.ansible.AnsiblePlayBook':{'queue':'ansible','routing_key':'ansible'},
}
CELERY_DEFAULT_QUEUE = 'default'
CELERY_DEFAULT_EXCHANGE_TYPE = 'topic'
CELERY_DEFAULT_ROUTING_KEY = 'default'
REDSI_KWARGS_LPUSH = {"host":'192.168.199.224','port':6379,'db':4}
REDSI_LPUSH_POOL = None
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'kd8f&jx1h^1m-uldfdo3d#10d9mbc-ijjz!tozusy@aw#h+875'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Channels settings
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer", # use redis backend
"CONFIG": {
"hosts": [("localhost", )],
"channel_capacity": {
"http.request": ,
"websocket.send*": ,
},
"capacity": ,
},
"ROUTING": "OpsManage.routing.channel_routing", # load routing from our routing.py file
},
}
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'OpsManage',
'rest_framework',
'djcelery',
'channels',
'storages',
'wiki',
'orders',
'api',
'filemanage',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
# 'django.middleware.csrf.CsrfResponseMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
}
ROOT_URLCONF = 'OpsManage.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["/mnt/OpsManage/OpsManage/static/",'/mnt/OpsManage/OpsManage/templates/'], ##根据下载的opsmanage存放位置
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'OpsManage.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE':'django.db.backends.mysql',
'NAME':'opsmanage',
'USER':'root',
'PASSWORD':'jason_zhang',
'HOST':'192.168.199.224'
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Shanghai'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'/mnt/OpsManage/OpsManage/static/',
)
MEDIA_ROOT = os.path.join(BASE_DIR,'upload/')
MEDIA_URL = '/upload/'
SFTP_CONF = {
'port':,
'username':'root',
'password':'welliam',
'timeout':
}
WORKSPACES = '/var/lib/opsmanage/workspaces/'
LOGIN_URL = '/login'

生成数据表与管理员账户

yum remove python-gssapi.x86_64    不然会django、Paramiko报错 

# cd /mnt/OpsManage/
# python manage.py makemigrations OpsManage
# python manage.py makemigrations wiki
# python manage.py makemigrations orders
# python manage.py makemigrations filemanage
# python manage.py migrate
# python manage.py createsuperuser

启动部署平台

# cd /mnt/OpsManage/
# python manage.py runserver 0.0.0.0:8000

 

注意,启动后,会占用当前终端,需要调整时开启新终端登录

http://192.168.199.224:8000

 

配置Celery异步任务系统

celery-分布式异步任务调度系统

了解:https://blog.csdn.net/bojie5744/article/details/52965668

# echo_supervisord_conf > /etc/supervisord.conf
# export PYTHONOPTIMIZE=1
# vim /etc/supervisord.conf

 在最后面加上

[program:celery-worker-default]
command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q default
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-worker-default.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-worker-ansible]
command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q ansible
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-worker-ansible.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-beat]
command=/usr/bin/python manage.py celery beat
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-beat.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-cam]
command=/usr/bin/python manage.py celerycam
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-celerycam.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1

 启动celery

# /usr/bin/supervisord -c /etc/supervisord.conf    #注意centos7上路径
# supervisorctl status #要检查是否都是running状态

 

 

SQL审核

自行安装Inception与SQLadvisor,SQLadvisor可执行文件请放在OpsManage服务器/usr/bin/sqladvisor路径 (不支持阿里云RDS)
详看inception+archery SQL审核平台 https://www.cnblogs.com/xiaoyou2018/p/9936585.html 参考:http://blog.51cto.com/11555417/2155028
https://github.com/welliamcao/OpsManage
https://www.oschina.net/p/opsmanage

Python 进程管理工具 Supervisor 使用教程
https://www.restran.net/2015/10/04/supervisord-tutorial/

opsmanage 自动化运维管理平台的更多相关文章

  1. Linux运维之Ansible自动化运维管理工具

    Ansible简介:Ansible是一个简单高效的自动化运维管理工具,用Python开发,能大批量管理N多台机器,可以并发的在多台机器上部署应用.安装软件.执行命令.配置和编排任务.后面会提到批量安装 ...

  2. django 实现linux运维管理平台

    概述 使用django实现一个linux运维管理平台,可以实现注册登录,机器管理 ,服务器批量操作,服务器性能监控. 详细 代码下载:http://www.demodashi.com/demo/112 ...

  3. Ansible 自动化运维管理工具

    Ansible 自动化运维管理工具 1.Ansible概述 2.Ansible部署 3.Ansible模块 1.Ansible概述: Ansible是一个基于Python开发的配置管理和应用部署工具, ...

  4. Ansible-Tower自动化运维管理环境 - 安装破解记录

    公司中实现运维自动化的架构中主要用到ansible,ansible脚本在部署服务器指令行中显得不太直观.Ansible-Tower(之前叫做awx)是将ansible的指令界面化,简明直观,简单易用. ...

  5. 安装配置OSA运维管理平台

    1.下载完整包V1.0.2wget http://www.osapub.com/download/OSA_BETA_V1.0.2.tar.gzV1.0.5wget http://www.osapub. ...

  6. ansible自动化运维管理工具

    1.Ansible介绍 1)Ansible:Ansible的核心程序 2)Host Inventory:(默认路径:/etc/ansible/hosts)记录了每一个由Ansible管理的主机信息,信 ...

  7. MySQL 运维管理平台

    github: https://github.com/XiaohaoYu/mysql_platform

  8. 国产安全自主可控IT智能运维管理解决方案

    新一轮科技革命和产业变革席卷全球,大数据.云计算.物联网.人工智能.区块链等新技术不断涌现,数字经济正深刻地改变着人类的生产和生活方式,作为经济增长新动能的作用日益凸显.伴随增长的,还有网络中不断涌现 ...

  9. 解决连锁零售行业IT运维管理四大困境

    解决连锁零售行业IT运维管理四大困境   中国近年来,连锁零售行业进入了行业的发展高潮,迅速崛起一批大型连锁业态.而随着IT技术的不断进步,连锁零售企业已经步入IT信息化快速发展的重要阶段:在面对激烈 ...

随机推荐

  1. Weblogic重起后打开控制台登陆后响应极慢

    linux下Weblogic 重启后第一次打开console登陆后响应极慢(20多分钟)(锁定并编辑第一次也极慢),以后速度就正常了,重启后又会极慢! 在网上看了看,是说linux下的java生成随机 ...

  2. python中的upper、lower、capitalize、title

    upper()字符串中字母由小写变为大写 lower()字符串中字母由大写变为小写 capitalize()字符串中字母首字母大写其余小写 title()字符串中字母每个单词的首字母大写其余小写 举个 ...

  3. leetcode1006

    func clumsy(N int) int { var ary []int ; n-- { ary = append(ary, n) } re := N % //4个数字一组 firstgroup ...

  4. [记录] CSS 左边元素定长,右边元素获得剩余长度

    情景:左边元素定长,右边元素获得剩余长度 1. 左边设置浮动,右边元素宽度auto,可以不设置,默认auto,然后设置margin-left:左边元素宽度 <ul class="ent ...

  5. react-native启动页面设置,react-native-splash-screen

    用于解决iOS和Android启动白屏问题及简单的启动页面展示 下载 react-native-splash-screen yarn add react-native-splash-screen re ...

  6. PE 装机

    PE 装机 下载PE安装到硬盘启动. 下载win7安装原始文件ISO镜像文件,解压ISO到文件夹. 重启电脑,选择PE菜单. 打开windows安装器大全>选择 winntSetup> i ...

  7. 前后台交互实现点击超链接通过指定的 url 去网络或者文件服务器下载文件

    前台 VUE 界面: <el-table-column prop="attachment" align="center" label="附件详情 ...

  8. html中控制Tab键的顺序

      在做项目中,需要控制html页面上登陆表单的按Tab键的顺序,代码如下: <tr>                         <td width="19%&quo ...

  9. js数组方法解析

    js 数组有很多方法,其中有的常用,有的不常用,归纳几个常用的方法,做个总结: 1. 转换方法: 1.1 valueOf():调用这个方法会返回数组本身 <script> var arr ...

  10. Servlet基本_Httpリクエスト、レスポンス

    1.リクエスト リクエストは.リクエストライン.メッセージヘッダ.改行.メッセージボディで組まれる. 主なリクエストヘッダは. Accept クライアントが利用可能なデータメディアタイプを指定. Ac ...