[mysql]-inception和archer安装
安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
先开启一些防火墙端口 关闭selinux 免得后面忘记
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
firewall-cmd --zone=public --add-port=9123/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=6669/tcp --permanent
--permanent 永久生效, 没有此参数重启后失效
#图里面6379是我一开始开错了 导致一直报错数据库连不上
systemctl enable docker
service docker start
docker pull hhyo/archer
docker pull hhyo/inception
下载完成之后 查看镜像
docker images
在虚拟机111中创建/etc/inc.cnf
[inception] general_log=1 general_log_file=inception.log port=6669 socket=/tmp/inc.socket character-set-client-handshake=0 character-set-server=utf8 inception_language_code=zh-CN inception_remote_system_password=Hangzhou@123 inception_remote_system_user=root inception_remote_backup_port=3306 inception_remote_backup_host=192.168.10.111 inception_support_charset=utf8,utf8mb4 inception_enable_nullable=0 inception_check_primary_key=1 inception_check_column_comment=1 inception_check_table_comment=1 inception_osc_on=OFF inception_osc_bin_dir=/usr/bin inception_osc_min_table_size=1 inception_osc_chunk_time=0.1 inception_enable_blob_type=1 inception_check_column_default_value=1 |
创建/etc/settings.py
# -*- coding: UTF-8 -*- """ Django settings for archer project. Generated by 'django-admin startproject' using Django 1.8.17. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import pymysql pymysql.install_as_MySQLdb() BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'hfusaf2m4ot#7)fkw#di2bu6(cv0@opwmafx5n#6=3d%x^hpl6' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['*'] # 解决nginx部署跳转404 USE_X_FORWARDED_HOST = True # Application definition INSTALLED_APPS = ( 'django_admin_bootstrapped', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_apscheduler', 'sql', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'sql.check_login_middleware.CheckLoginMiddleware', 'sql.exception_logging_middleware.ExceptionLoggingMiddleware', ) ROOT_URLCONF = 'archer.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'sql/static')], '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', 'sql.processor.global_info', ], }, }, ] WSGI_APPLICATION = 'archer.wsgi.application' # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'zh-hans' TIME_ZONE = 'Asia/Shanghai' USE_I18N = True USE_TZ = False # 时间格式化 USE_L10N = False DATETIME_FORMAT = 'Y-m-d H:i:s' DATE_FORMAT = 'Y-m-d' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 扩展django admin里users字段用到,指定了sql/models.py里的class users AUTH_USER_MODEL = "sql.users" ###############以下部分需要用户根据自己环境自行修改################### # session 设置 SESSION_COOKIE_AGE = 60 * 30 # 30分钟 SESSION_SAVE_EVERY_REQUEST = True SESSION_EXPIRE_AT_BROWSER_CLOSE = True # 关闭浏览器,则COOKIE失效 # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases # 该项目本身的mysql数据库地址 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'archer_github', 'USER': 'root', 'PASSWORD': 'Hangzhou@123', 'HOST': '192.168.10.111', 'PORT': '3306' } } # inception组件所在的地址 INCEPTION_HOST = '192.168.10.111' INCEPTION_PORT = '6669' # 查看回滚SQL时候会用到,这里要告诉archer去哪个mysql里读取inception备份的回滚信息和SQL. # 注意这里要和inception组件的inception.conf里的inception_remote_XX部分保持一致. INCEPTION_REMOTE_BACKUP_HOST = '192.168.10.111' INCEPTION_REMOTE_BACKUP_PORT = 3306 INCEPTION_REMOTE_BACKUP_USER = 'inception' INCEPTION_REMOTE_BACKUP_PASSWORD = 'inception' # 账户登录失败锁定时间(秒) LOCK_TIME_THRESHOLD = 300 # 账户登录失败 几次 锁账户 LOCK_CNT_THRESHOLD = 5 # LDAP ENABLE_LDAP = False if ENABLE_LDAP: import ldap # from django_auth_ldap.config import LDAPSearch, GroupOfNamesType from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', # 配置为先使用LDAP认证,如通过认证则不再使用后面的认证方式 'django.contrib.auth.backends.ModelBackend', # sso系统中手动创建的用户也可使用,优先级靠后。注意这2行的顺序 ) # if use self signed certificate, Remove AUTH_LDAP_GLOBAL_OPTIONS annotations # AUTH_LDAP_GLOBAL_OPTIONS={ # ldap.OPT_X_TLS_REQUIRE_CERT: ldap.OPT_X_TLS_NEVER # } AUTH_LDAP_BIND_DN = "cn=xx,dc=xx,dc=xx" AUTH_LDAP_BIND_PASSWORD = "xx" AUTH_LDAP_SERVER_URI = "ldap://ldap.xx.com" AUTH_LDAP_BASEDN = "dc=xx,dc=xx" AUTH_LDAP_USER_DN_TEMPLATE = "cn=%(user)s,ou=xx,dc=xx,dc=xx" AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=xx,dc=xx,dc=xx", ldap.SCOPE_SUBTREE, "(objectClass=groupOfUniqueNames)" ) AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType() AUTH_LDAP_ALWAYS_UPDATE_USER = True # 每次登录从ldap同步用户信息 AUTH_LDAP_USER_ATTR_MAP = { # key为archer.sql_users字段名,value为ldap中字段名,用于同步用户信息 "username": "xx", "display": "xx", "email": "xx" } # AUTH_LDAP_MIRROR_GROUPS = True # 直接把ldap的组复制到django一份,和AUTH_LDAP_FIND_GROUP_PERMS互斥.用户每次登录会根据ldap来更新数据库的组关系 # AUTH_LDAP_FIND_GROUP_PERMS = True # django从ldap的组权限中获取权限,这种方式,django自身不创建组,每次请求都调用ldap # AUTH_LDAP_CACHE_GROUPS = True # 如打开FIND_GROUP_PERMS后,此配置生效,对组关系进行缓存,不用每次请求都调用ldap # AUTH_LDAP_GROUP_CACHE_TIMEOUT = 600 # 缓存时间 # 开启以下配置注释,可以帮助调试ldap集成 LDAP_LOGS = '/opt/ldap.log' DEFAULT_LOGS = '/tmp/default.log' stamdard_format = '[%(asctime)s][%(threadName)s:%(thread)d]' + \ '[task_id:%(name)s][%(filename)s:%(lineno)d] ' + \ '[%(levelname)s]- %(message)s' LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { # 详细 'format': stamdard_format }, }, 'handlers': { 'default': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': DEFAULT_LOGS, 'maxBytes': 1024 * 1024 * 100, # 5 MB 'backupCount': 5, 'formatter': 'standard', }, 'ldap': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': LDAP_LOGS, 'maxBytes': 1024 * 1024 * 100, # 5 MB 'backupCount': 5, 'formatter': 'standard', }, 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', } }, 'loggers': { 'default': { # default日志,存放于log中 'handlers': ['default'], 'level': 'DEBUG', }, # 'django.db': { # 打印SQL语句到console,方便开发 # 'handlers': ['console'], # 'level': 'DEBUG', # 'propagate': False, # }, 'django.request': { # 打印错误堆栈信息到console,方便开发 'handlers': ['console'], 'level': 'DEBUG', 'propagate': False, }, 'django_auth_ldap': { # django_auth_ldap模块相关日志打印到console 'handlers': ['ldap'], 'level': 'DEBUG', 'propagate': True, # 选择关闭继承,不然这个logger继承自默认,日志就会被记录2次了(''一次,自己一次) } } } # 是否开启邮件提醒功能:发起SQL上线后会发送邮件提醒审核人审核,执行完毕会发送给DBA. on是开,off是关,配置为其他值均会被archer认为不开启邮件功能 MAIL_ON_OFF = 'on' MAIL_SSL = True # 是否使用SSL MAIL_REVIEW_SMTP_SERVER = 'smtp.mxhichina.com' MAIL_REVIEW_SMTP_PORT = 465 MAIL_REVIEW_FROM_ADDR = 'inception@pdabc.com' # 发件人,也是登录SMTP server需要提供的用户名 MAIL_REVIEW_FROM_PASSWORD = 'Pdabc123' # 发件人邮箱密码,如果为空则不需要login SMTP server # 是否过滤【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】等高危DDL操作: # on是开,会首先用正则表达式匹配sqlContent,如果匹配到高危DDL操作,则判断为“自动审核不通过”;off是关,直接将所有的SQL语句提交给inception,对于上述高危DDL操作,只备份元数据 CRITICAL_DDL_ON_OFF = 'off' # 是否开启SQL查询功能,关闭会隐藏菜单和相关功能 QUERY = True # 当inception语法树打印失败时在线查询的结果控制,建议修改inception变量inception_enable_select_star=OFF,否则select * 会报错 # True是开启校验,失败不允许继续执行并返回错, # False是关闭校验,继续执行,关闭校验会导致解析失败的查询表权限验证和脱敏功能失效 CHECK_QUERY_ON_OFF = True # 是否开启动态脱敏查询,采取正则遍历处理结果集的方式,会影响部分查询效率 DATA_MASKING_ON_OFF = True # 管理员在线查询的结果集限制 ADMIN_QUERY_LIMIT = 5000 # 是否开启慢日志管理,关闭会隐藏菜单和相关功能 SLOWQUERY = True # sqladvisor的路径配置,如'/opt/SQLAdvisor/sqladvisor/sqladvisor',''代表关闭,隐藏菜单和相关功能 SQLADVISOR = '/opt/SQLAdvisor/sqladvisor/sqladvisor' # 是否开启AliYunRDS管理 ALIYUN_RDS_MANAGE = True |
在192.168.10.111上安装mysql5.7 账号密码root/Hangzhou@123
过程(略)
启动容器 把配置文件也挂进去
docker run --name inception -v /etc/inc.cnf:/etc/inc.cnf -p 6669:6669 -dti hhyo/inception
#docker run --name inception -p 6669:6669 -dti hhyo/inception
直接进去改也行的
进入inception容器操作
docker exec -ti inception /bin/bash
创建或者确保/etc/inc.cnf 内容如下
启动archer 镜像前面没有pull也没关系 本地没有会下载的
docker run --name archer -v /etc/settings.py:/opt/archer/archer/settings.py -e NGINX_PORT=9123 -p 9123:9123 -dti hhyo/archer
进入archer容器操作
docker exec -ti archer/bin/bash
修改或者确保/opt/archer/archer/settings.py
把数据库地址 和备份数据库地址密码替换一下。要开启的功能都开启
# -*- coding: UTF-8 -*- """ Django settings for archer project. Generated by 'django-admin startproject' using Django 1.8.17. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import pymysql pymysql.install_as_MySQLdb() BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'hfusaf2m4ot#7)fkw#di2bu6(cv0@opwmafx5n#6=3d%x^hpl6' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['*'] # 解决nginx部署跳转404 USE_X_FORWARDED_HOST = True # Application definition INSTALLED_APPS = ( 'django_admin_bootstrapped', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_apscheduler', 'sql', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'sql.check_login_middleware.CheckLoginMiddleware', 'sql.exception_logging_middleware.ExceptionLoggingMiddleware', ) ROOT_URLCONF = 'archer.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'sql/static')], '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', 'sql.processor.global_info', ], }, }, ] WSGI_APPLICATION = 'archer.wsgi.application' # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'zh-hans' TIME_ZONE = 'Asia/Shanghai' USE_I18N = True USE_TZ = False # 时间格式化 USE_L10N = False DATETIME_FORMAT = 'Y-m-d H:i:s' DATE_FORMAT = 'Y-m-d' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 扩展django admin里users字段用到,指定了sql/models.py里的class users AUTH_USER_MODEL = "sql.users" ###############以下部分需要用户根据自己环境自行修改################### # session 设置 SESSION_COOKIE_AGE = 60 * 30 # 30分钟 SESSION_SAVE_EVERY_REQUEST = True SESSION_EXPIRE_AT_BROWSER_CLOSE = True # 关闭浏览器,则COOKIE失效 # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases # 该项目本身的mysql数据库地址 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'archer_github', 'USER': 'root', 'PASSWORD': 'Hangzhou@123', 'HOST': '192.168.10.111', 'PORT': '3306' } } # inception组件所在的地址 INCEPTION_HOST = '192.168.10.111' INCEPTION_PORT = '6669' # 查看回滚SQL时候会用到,这里要告诉archer去哪个mysql里读取inception备份的回滚信息和SQL. # 注意这里要和inception组件的inception.conf里的inception_remote_XX部分保持一致. INCEPTION_REMOTE_BACKUP_HOST = '192.168.10.111' INCEPTION_REMOTE_BACKUP_PORT = 3306 INCEPTION_REMOTE_BACKUP_USER = 'inception' INCEPTION_REMOTE_BACKUP_PASSWORD = 'inception' # 账户登录失败锁定时间(秒) LOCK_TIME_THRESHOLD = 300 # 账户登录失败 几次 锁账户 LOCK_CNT_THRESHOLD = 5 # LDAP ENABLE_LDAP = False if ENABLE_LDAP: import ldap # from django_auth_ldap.config import LDAPSearch, GroupOfNamesType from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', # 配置为先使用LDAP认证,如通过认证则不再使用后面的认证方式 'django.contrib.auth.backends.ModelBackend', # sso系统中手动创建的用户也可使用,优先级靠后。注意这2行的顺序 ) # if use self signed certificate, Remove AUTH_LDAP_GLOBAL_OPTIONS annotations # AUTH_LDAP_GLOBAL_OPTIONS={ # ldap.OPT_X_TLS_REQUIRE_CERT: ldap.OPT_X_TLS_NEVER # } AUTH_LDAP_BIND_DN = "cn=xx,dc=xx,dc=xx" AUTH_LDAP_BIND_PASSWORD = "xx" AUTH_LDAP_SERVER_URI = "ldap://ldap.xx.com" AUTH_LDAP_BASEDN = "dc=xx,dc=xx" AUTH_LDAP_USER_DN_TEMPLATE = "cn=%(user)s,ou=xx,dc=xx,dc=xx" AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=xx,dc=xx,dc=xx", ldap.SCOPE_SUBTREE, "(objectClass=groupOfUniqueNames)" ) AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType() AUTH_LDAP_ALWAYS_UPDATE_USER = True # 每次登录从ldap同步用户信息 AUTH_LDAP_USER_ATTR_MAP = { # key为archer.sql_users字段名,value为ldap中字段名,用于同步用户信息 "username": "xx", "display": "xx", "email": "xx" } # AUTH_LDAP_MIRROR_GROUPS = True # 直接把ldap的组复制到django一份,和AUTH_LDAP_FIND_GROUP_PERMS互斥.用户每次登录会根据ldap来更新数据库的组关系 # AUTH_LDAP_FIND_GROUP_PERMS = True # django从ldap的组权限中获取权限,这种方式,django自身不创建组,每次请求都调用ldap # AUTH_LDAP_CACHE_GROUPS = True # 如打开FIND_GROUP_PERMS后,此配置生效,对组关系进行缓存,不用每次请求都调用ldap # AUTH_LDAP_GROUP_CACHE_TIMEOUT = 600 # 缓存时间 # 开启以下配置注释,可以帮助调试ldap集成 LDAP_LOGS = '/opt/ldap.log' DEFAULT_LOGS = '/tmp/default.log' stamdard_format = '[%(asctime)s][%(threadName)s:%(thread)d]' + \ '[task_id:%(name)s][%(filename)s:%(lineno)d] ' + \ '[%(levelname)s]- %(message)s' LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { # 详细 'format': stamdard_format }, }, 'handlers': { 'default': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': DEFAULT_LOGS, 'maxBytes': 1024 * 1024 * 100, # 5 MB 'backupCount': 5, 'formatter': 'standard', }, 'ldap': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': LDAP_LOGS, 'maxBytes': 1024 * 1024 * 100, # 5 MB 'backupCount': 5, 'formatter': 'standard', }, 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', } }, 'loggers': { 'default': { # default日志,存放于log中 'handlers': ['default'], 'level': 'DEBUG', }, # 'django.db': { # 打印SQL语句到console,方便开发 # 'handlers': ['console'], # 'level': 'DEBUG', # 'propagate': False, # }, 'django.request': { # 打印错误堆栈信息到console,方便开发 'handlers': ['console'], 'level': 'DEBUG', 'propagate': False, }, 'django_auth_ldap': { # django_auth_ldap模块相关日志打印到console 'handlers': ['ldap'], 'level': 'DEBUG', 'propagate': True, # 选择关闭继承,不然这个logger继承自默认,日志就会被记录2次了(''一次,自己一次) } } } # 是否开启邮件提醒功能:发起SQL上线后会发送邮件提醒审核人审核,执行完毕会发送给DBA. on是开,off是关,配置为其他值均会被archer认为不开启邮件功能 MAIL_ON_OFF = 'on' MAIL_SSL = True # 是否使用SSL MAIL_REVIEW_SMTP_SERVER = 'smtp.mxhichina.com' MAIL_REVIEW_SMTP_PORT = 465 MAIL_REVIEW_FROM_ADDR = 'inception@pdabc.com' # 发件人,也是登录SMTP server需要提供的用户名 MAIL_REVIEW_FROM_PASSWORD = 'Pdabc123' # 发件人邮箱密码,如果为空则不需要login SMTP server # 是否过滤【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】等高危DDL操作: # on是开,会首先用正则表达式匹配sqlContent,如果匹配到高危DDL操作,则判断为“自动审核不通过”;off是关,直接将所有的SQL语句提交给inception,对于上述高危DDL操作,只备份元数据 CRITICAL_DDL_ON_OFF = 'off' # 是否开启SQL查询功能,关闭会隐藏菜单和相关功能 QUERY = True # 当inception语法树打印失败时在线查询的结果控制,建议修改inception变量inception_enable_select_star=OFF,否则select * 会报错 # True是开启校验,失败不允许继续执行并返回错, # False是关闭校验,继续执行,关闭校验会导致解析失败的查询表权限验证和脱敏功能失效 CHECK_QUERY_ON_OFF = True # 是否开启动态脱敏查询,采取正则遍历处理结果集的方式,会影响部分查询效率 DATA_MASKING_ON_OFF = True # 管理员在线查询的结果集限制 ADMIN_QUERY_LIMIT = 5000 # 是否开启慢日志管理,关闭会隐藏菜单和相关功能 SLOWQUERY = True # sqladvisor的路径配置,如'/opt/SQLAdvisor/sqladvisor/sqladvisor',''代表关闭,隐藏菜单和相关功能 SQLADVISOR = '/opt/SQLAdvisor/sqladvisor/sqladvisor' # 是否开启AliYunRDS管理 ALIYUN_RDS_MANAGE = True |
cd /opt/archer
source /opt/venv4archer/bin/activate
# 初始化数据库
python3 manage.py makemigrations sql
python3 manage.py migrate
# 创建管理员账号 这里创建的用户是django用户 后续用来创建新用户和添加数据库 比较重要
python3 manage.py createsuperuser
登陆平台
登陆后台创建用户添加数据库信息
http://192.168.10.105:9123/admin/login/?next=/admin/sql/
开启阿里云RDS的话 会是下面的界面 不开启就没有这2个选项
开始创建用户
点击进入之后 发现jiaminxu的账号是工程师 超级用户 这个用户是不能对sql进行审批的 需要创建dba账号
创建dba账号
点击保存并继续编辑 这里忘记选dba了 在修改一下 更换成dba
保存之后 如果需要再次修改 可以如下操作
使用用户dba_hugo测试一下登陆
可以发现左边的栏 比超级用户少 并且这个dba用户是不能登陆django 管理界面的。
下面开始配置数据库
拿备份库192.168.10.106测试 登陆django管理界面 用jiaminxu登陆 选择主库地址配置 增加
保存即可 界面是明文
测试拿106做测试 事先创好数据库
点击提交sql按钮
选择库 是否备份 审核人
依次点击 美化 > sql检测 > sql提交
不经过检测的sql是不能点击提交的
1测试sql通过的情况
2测试不指定数据库的情况 会报错 和错误sql一样无法提交
美化之后提交
立即执行
剩下回滚就是再走一次流程了- -。
[mysql]-inception和archer安装相关推荐
- MySQL解压版安装
MySQL解压版安装 1.下载对应版本的MySQL压缩包. 2.把压缩包解压在指定的位置. 3.在安装目录里面建一个文件,文件名字是指定的 my.ini 文件 4.在配置文件中写入如下的配置代码: [ ...
- mysql 5.7编译安装重启_mysql5.7源码编译安装
安装mysql前的准备: 一.安装依赖的库: yum install gcc-c++ ncurses-devel perl-Data-Dumper python-devel openssl open ...
- linux编译安装mysql 5.1_linux编译安装mysql5.1.x
安装mysql,安装前准备 如果mysql用户不存在,那么添加mysql用户 groupadd mysql useradd -g mysql mysql mysql编译安装 make时间特别长 wge ...
- mysql下载解压安装_mysql zip 解压安装
系统:win10 专业版 mysql 5.7.21 解压安装. 对于Windows,mysql官网推荐使用可执行文件进行安装,这里我还是暂时用noinstall 解压zip文件来安装 从zip压缩包安 ...
- 高可用架构篇 MySQL源码编译安装(CentOS-6.6+MySQL-5.6)
部署环境 操作系统:CentOS-6.6-x86_64-bin-DVD1.iso MySQL版本:mysql-5.6.26.tar.gz 操作用户:root 系统IP:192.168.1.205 主机 ...
- 在Red Hat Linux5下构建LAMP网站服务平台之MySQL、PHP的安装与配置
在Red Hat Linux5下构建LAMP网站服务平台之MySQL.PHP的安装与配置 2010-09-09 16:40:49 标签:PHP Linux mysql RedHat [推送到技术圈] ...
- 在linux上MySQL的三种安装方式
安装MySQL的方式常见的有三种: 方式一:rpm安装 (1) 操作系统发行商提供的 (2) MySQL官方提供的(版本更新,修复了更多常见BUG)www.mysql.com/downloads 关于 ...
- 【安装】Mysql在Linux上安装
1.下载 下载地址:http://dev.mysql.com/downloads/mysql/5.6.html#downloads 下载版本:mysql-5.6.37-linux-glibc2.12- ...
- 从 Blast2GO 本地化聊一聊 Linux 下 MySQL 的源码安装
Blast2GO 是一个基于序列相似性搜索的 GO 注释和功能分析工具,它可以直接统计分析基因功能信息,并可视化 GO 有向非循环图(DAG)上的相关功能特征,分析 BLAST.GO-mapping. ...
最新文章
- Power Designer逆向工程导入Oracle表,转为模型加注释
- JetsonXavier/Tx2性能测试比对
- Java 8 - 收集器Collectors_归约和汇总
- “200亿先生”沈腾加持,BOSS直聘能让中国人找到好老板吗?
- windows 程序设计及API
- 硬核评测:企业上云的极速存储挑战,华为云全新极速IO云硬盘性能评测
- 南京航空航天大学计算机网课,南京航空航天大学课程教学大纲-南京航空航天大学计算机科学与技术(9页)-原创力文档...
- 玩转springboot2.x 通过druid-spring-boot-starter整合Druid(Mybatis版)
- ASP.Net学习笔记010--加法计算器
- upc 7833 生日蛋糕
- 苹果mac微软表格处理工具:microsoftexcel
- 11款极酷Chrome浏览器插件推荐
- SpringMVC工作原理图
- HP-Socket通信框架使用入门
- 通过思翼SIYI MK15E回传Realsense D435i 的 RGB图像
- 人脸识别中怎么区分人脸和照片
- Excel文件损坏打不开的常见原因及解决方法
- php空间开启伪静态,php虚拟主机开启伪静态(虚拟主机伪静态规则配置)
- 如何学Python?--捕蛇者说
- Linux设备之我是usb,linux那些事儿之我是usb