New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级新版本数据库不兼容问题 #1859

Open
BigbigY opened this Issue Sep 27, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@BigbigY

BigbigY commented Sep 27, 2018

[简述你的问题]
原1.3.1升级到1.4.1

使用版本

旧1.3.1使用到mysql版本为5.5, centos6.5
新1.4.1使用到mariadb版本为5.5.60-MariaDB, centos7

问题复现步骤
  1. 新机器部署新版本jumpserver
  2. 导出1.3.1数据库备份,导入1.4.1jumpserver 数据库成功
  3. bash make_migrations.sh报错
2018-09-27 11:16:17 [signals_handler DEBUG] Receive django ready signal
2018-09-27 11:16:17 [signals_handler DEBUG]   - fresh all settings
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 103, in handle
    loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180927_1020 on database 'default'.
2018-09-27 11:16:18 [signals_handler DEBUG] Receive django ready signal
2018-09-27 11:16:18 [signals_handler DEBUG]   - fresh all settings
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
	HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180927_1020 on database 'default'.
2018-09-27 11:16:20 [signals_handler DEBUG] Receive django ready signal
2018-09-27 11:16:20 [signals_handler DEBUG]   - fresh all settings
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 103, in handle
    loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180927_1020 on database 'default'.
具体表现[截图可能会更好些,最好能截全]
其他

[注:] 完成后请关闭 issue

@oudemen

This comment has been minimized.

Show comment
Hide comment
@oudemen

oudemen Sep 27, 2018

jumpserver1.4.1基于django2.1 django2.1不兼容mysql5.5了
你只能升级mysql或者用旧版本了

oudemen commented Sep 27, 2018

jumpserver1.4.1基于django2.1 django2.1不兼容mysql5.5了
你只能升级mysql或者用旧版本了

@BigbigY

This comment has been minimized.

Show comment
Hide comment
@BigbigY

BigbigY Sep 27, 2018

@oudemen 我升级mysql完,但是我怎么导入老的mysql5.5的数据启动不失败那

BigbigY commented Sep 27, 2018

@oudemen 我升级mysql完,但是我怎么导入老的mysql5.5的数据启动不失败那

@wojiushixiaobai

This comment has been minimized.

Show comment
Hide comment
@wojiushixiaobai

wojiushixiaobai Sep 28, 2018

Collaborator

@BigbigY 表结构数据也要复制过去,重新操作下,离线升级文档里面说明了如果备份和复制数据库表结构文件

Collaborator

wojiushixiaobai commented Sep 28, 2018

@BigbigY 表结构数据也要复制过去,重新操作下,离线升级文档里面说明了如果备份和复制数据库表结构文件

@BigbigY

This comment has been minimized.

Show comment
Hide comment
@BigbigY

BigbigY Sep 28, 2018

@wojiushixiaobai 我按照文档中复制老的数据结构到新到jumpserver后,报错了

for d in $(ls);do
>     if [ -d $d ] && [ -d $d/migrations ];then
>       cp ${d}/migrations/*.py /opt/jumpserver/apps/${d}/migrations/
>     fi
>   done
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/audits/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/common/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/0002_auto_20171225_1157.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/__init__.py"? y

启动jms失败
image
登陆web后报错
image

BigbigY commented Sep 28, 2018

@wojiushixiaobai 我按照文档中复制老的数据结构到新到jumpserver后,报错了

for d in $(ls);do
>     if [ -d $d ] && [ -d $d/migrations ];then
>       cp ${d}/migrations/*.py /opt/jumpserver/apps/${d}/migrations/
>     fi
>   done
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/audits/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/common/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/0001_initial.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/0002_auto_20171225_1157.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/__init__.py"? y

启动jms失败
image
登陆web后报错
image

@wojiushixiaobai

This comment has been minimized.

Show comment
Hide comment
@wojiushixiaobai

wojiushixiaobai Sep 28, 2018

Collaborator

@BigbigY 复制完成后,重新执行
$ sh make_migrations.sh
如果任然有问题,备份整个jumpserver文件夹和数据库
$ sh clean_migrations.sh
# 然后再还原数据库表结构文件
$ sh make_migrations.sh

Collaborator

wojiushixiaobai commented Sep 28, 2018

@BigbigY 复制完成后,重新执行
$ sh make_migrations.sh
如果任然有问题,备份整个jumpserver文件夹和数据库
$ sh clean_migrations.sh
# 然后再还原数据库表结构文件
$ sh make_migrations.sh

@BigbigY

This comment has been minimized.

Show comment
Hide comment
@BigbigY

BigbigY Sep 28, 2018

@wojiushixiaobai 还是一样的异常

(py3) [root@ip-xxxx utils]# sh clean_migrations.sh
(py3) [root@ip-xxxx utils]# cd /tmp/
(py3) [root@ip-xxxx tmp]# cd jumpserver_backup/
(py3) [root@ip-xxxx jumpserver_backup]# for d in $(ls);do
>     if [ -d $d ] && [ -d $d/migrations ];then
>       cp ${d}/migrations/*.py /opt/jumpserver/apps/${d}/migrations/
>     fi
>   done
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/audits/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/common/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/__init__.py"? y
(py3) [root@ip-xxxx jumpserver_backup]# cd /opt/jumpserver/utils/
(py3) [root@ip-xxxx utils]# sh make_migrations.sh
2018-09-28 10:30:18 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:18 [signals_handler DEBUG]   - fresh all settings
Migrations for 'assets':
  /opt/jumpserver/apps/assets/migrations/0002_auto_20180928_1030.py
    - Create model Domain
    - Create model Gateway
    - Create model Label
    - Create model Node
    - Change Meta options on adminuser
    - Change Meta options on asset
    - Change Meta options on assetgroup
    - Change Meta options on cluster
    - Change Meta options on systemuser
    - Add field org_id to adminuser
    - Add field cpu_vcpus to asset
    - Add field org_id to asset
    - Add field protocol to asset
    - Add field assets to systemuser
    - Add field login_mode to systemuser
    - Add field org_id to systemuser
    - Alter field created_by on adminuser
    - Alter field name on adminuser
    - Alter field username on adminuser
    - Alter field admin_user on asset
    - Alter field hostname on asset
    - Alter field platform on asset
    - Alter field created_by on assetgroup
    - Alter field created_by on systemuser
    - Alter field name on systemuser
    - Alter field protocol on systemuser
    - Alter field sudo on systemuser
    - Alter field username on systemuser
    - Alter unique_together for adminuser (1 constraint(s))
    - Remove field cabinet_no from asset
    - Remove field cabinet_pos from asset
    - Remove field cluster from asset
    - Remove field env from asset
    - Remove field groups from asset
    - Remove field remote_card_ip from asset
    - Remove field status from asset
    - Remove field type from asset
    - Add field domain to asset
    - Add field labels to asset
    - Add field nodes to asset
    - Alter unique_together for asset (1 constraint(s))
    - Remove field cluster from systemuser
    - Add field nodes to systemuser
    - Alter unique_together for systemuser (1 constraint(s))
    - Alter unique_together for label (1 constraint(s))
    - Alter unique_together for gateway (1 constraint(s))
Migrations for 'common':
  /opt/jumpserver/apps/common/migrations/0001_initial.py
    - Create model Setting
Migrations for 'ops':
  /opt/jumpserver/apps/ops/migrations/0002_celerytask.py
    - Create model CeleryTask
Migrations for 'orgs':
  /opt/jumpserver/apps/orgs/migrations/0001_initial.py
    - Create model Organization
Migrations for 'terminal':
  /opt/jumpserver/apps/terminal/migrations/0002_auto_20180928_1030.py
    - Add field org_id to command
    - Add field date_last_active to session
    - Add field org_id to session
    - Add field protocol to session
    - Add field remote_addr to session
    - Add field terminal to session
    - Add field terminal to status
    - Add field terminal to task
    - Add field command_storage to terminal
    - Add field replay_storage to terminal
    - Add field user to terminal
    - Alter field asset on command
    - Alter field system_user on command
    - Alter field user on command
    - Alter field date_start on session
    - Alter field name on terminal
Migrations for 'users':
  /opt/jumpserver/apps/users/migrations/0003_auto_20180928_1030.py
    - Change Meta options on user
    - Change Meta options on usergroup
    - Remove field enable_otp from user
    - Remove field secret_key_otp from user
    - Add field mfa to loginlog
    - Add field reason to loginlog
    - Add field status to loginlog
    - Add field _otp_secret_key to user
    - Add field otp_level to user
    - Add field source to user
    - Add field org_id to usergroup
    - Alter field date_expired on user
    - Alter field is_first_login on user
    - Alter field last_name on user
    - Alter field created_by on usergroup
    - Remove field discard_time from usergroup
    - Remove field is_discard from usergroup
    - Alter unique_together for usergroup (1 constraint(s))
Migrations for 'audits':
  /opt/jumpserver/apps/audits/migrations/0001_initial.py
    - Create model FTPLog
    - Create model OperateLog
    - Create model PasswordChangeLog
    - Create proxy model UserLoginLog
Migrations for 'perms':
  /opt/jumpserver/apps/perms/migrations/0002_auto_20180928_1030.py
    - Create model NodePermission
    - Change Meta options on assetpermission
    - Add field date_start to assetpermission
    - Add field nodes to assetpermission
    - Add field org_id to assetpermission
    - Add field user_groups to assetpermission
    - Add field users to assetpermission
    - Alter field date_expired on assetpermission
    - Alter field name on assetpermission
    - Remove field asset_groups from assetpermission
    - Alter unique_together for assetpermission (1 constraint(s))
2018-09-28 10:30:20 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:20 [signals_handler DEBUG]   - fresh all settings
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
	HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
2018-09-28 10:30:21 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:21 [signals_handler DEBUG]   - fresh all settings
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 103, in handle
    loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
(py3) [root@ip-xxxx opt]# cd jumpserver
(py3) [root@ip-xxxx jumpserver]# ./jms restart -d
Stop service: gunicorn
Stop service: celery
Stop service: beat
Fri Sep 28 02:30:44 2018
Jumpserver version 1.4.1, more see https://www.jumpserver.org

- Start Gunicorn WSGI HTTP Server
Check database structure change ...
2018-09-28 10:30:45 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:45 [signals_handler DEBUG]   - fresh all settings
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
	HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
Traceback (most recent call last):
  File "manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
Collect static files
2018-09-28 10:30:47 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:47 [signals_handler DEBUG]   - fresh all settings

0 static files copied to '/opt/jumpserver/data/static', 451 unmodified.

- Start Celery as Distributed Task Queue

- Start Beat as Periodic Task Scheduler

gunicorn is running: 10096
celery is running: 10111
beat is running: 10114

BigbigY commented Sep 28, 2018

@wojiushixiaobai 还是一样的异常

(py3) [root@ip-xxxx utils]# sh clean_migrations.sh
(py3) [root@ip-xxxx utils]# cd /tmp/
(py3) [root@ip-xxxx tmp]# cd jumpserver_backup/
(py3) [root@ip-xxxx jumpserver_backup]# for d in $(ls);do
>     if [ -d $d ] && [ -d $d/migrations ];then
>       cp ${d}/migrations/*.py /opt/jumpserver/apps/${d}/migrations/
>     fi
>   done
cp:是否覆盖"/opt/jumpserver/apps/assets/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/audits/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/common/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/ops/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/perms/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/terminal/migrations/__init__.py"? y
cp:是否覆盖"/opt/jumpserver/apps/users/migrations/__init__.py"? y
(py3) [root@ip-xxxx jumpserver_backup]# cd /opt/jumpserver/utils/
(py3) [root@ip-xxxx utils]# sh make_migrations.sh
2018-09-28 10:30:18 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:18 [signals_handler DEBUG]   - fresh all settings
Migrations for 'assets':
  /opt/jumpserver/apps/assets/migrations/0002_auto_20180928_1030.py
    - Create model Domain
    - Create model Gateway
    - Create model Label
    - Create model Node
    - Change Meta options on adminuser
    - Change Meta options on asset
    - Change Meta options on assetgroup
    - Change Meta options on cluster
    - Change Meta options on systemuser
    - Add field org_id to adminuser
    - Add field cpu_vcpus to asset
    - Add field org_id to asset
    - Add field protocol to asset
    - Add field assets to systemuser
    - Add field login_mode to systemuser
    - Add field org_id to systemuser
    - Alter field created_by on adminuser
    - Alter field name on adminuser
    - Alter field username on adminuser
    - Alter field admin_user on asset
    - Alter field hostname on asset
    - Alter field platform on asset
    - Alter field created_by on assetgroup
    - Alter field created_by on systemuser
    - Alter field name on systemuser
    - Alter field protocol on systemuser
    - Alter field sudo on systemuser
    - Alter field username on systemuser
    - Alter unique_together for adminuser (1 constraint(s))
    - Remove field cabinet_no from asset
    - Remove field cabinet_pos from asset
    - Remove field cluster from asset
    - Remove field env from asset
    - Remove field groups from asset
    - Remove field remote_card_ip from asset
    - Remove field status from asset
    - Remove field type from asset
    - Add field domain to asset
    - Add field labels to asset
    - Add field nodes to asset
    - Alter unique_together for asset (1 constraint(s))
    - Remove field cluster from systemuser
    - Add field nodes to systemuser
    - Alter unique_together for systemuser (1 constraint(s))
    - Alter unique_together for label (1 constraint(s))
    - Alter unique_together for gateway (1 constraint(s))
Migrations for 'common':
  /opt/jumpserver/apps/common/migrations/0001_initial.py
    - Create model Setting
Migrations for 'ops':
  /opt/jumpserver/apps/ops/migrations/0002_celerytask.py
    - Create model CeleryTask
Migrations for 'orgs':
  /opt/jumpserver/apps/orgs/migrations/0001_initial.py
    - Create model Organization
Migrations for 'terminal':
  /opt/jumpserver/apps/terminal/migrations/0002_auto_20180928_1030.py
    - Add field org_id to command
    - Add field date_last_active to session
    - Add field org_id to session
    - Add field protocol to session
    - Add field remote_addr to session
    - Add field terminal to session
    - Add field terminal to status
    - Add field terminal to task
    - Add field command_storage to terminal
    - Add field replay_storage to terminal
    - Add field user to terminal
    - Alter field asset on command
    - Alter field system_user on command
    - Alter field user on command
    - Alter field date_start on session
    - Alter field name on terminal
Migrations for 'users':
  /opt/jumpserver/apps/users/migrations/0003_auto_20180928_1030.py
    - Change Meta options on user
    - Change Meta options on usergroup
    - Remove field enable_otp from user
    - Remove field secret_key_otp from user
    - Add field mfa to loginlog
    - Add field reason to loginlog
    - Add field status to loginlog
    - Add field _otp_secret_key to user
    - Add field otp_level to user
    - Add field source to user
    - Add field org_id to usergroup
    - Alter field date_expired on user
    - Alter field is_first_login on user
    - Alter field last_name on user
    - Alter field created_by on usergroup
    - Remove field discard_time from usergroup
    - Remove field is_discard from usergroup
    - Alter unique_together for usergroup (1 constraint(s))
Migrations for 'audits':
  /opt/jumpserver/apps/audits/migrations/0001_initial.py
    - Create model FTPLog
    - Create model OperateLog
    - Create model PasswordChangeLog
    - Create proxy model UserLoginLog
Migrations for 'perms':
  /opt/jumpserver/apps/perms/migrations/0002_auto_20180928_1030.py
    - Create model NodePermission
    - Change Meta options on assetpermission
    - Add field date_start to assetpermission
    - Add field nodes to assetpermission
    - Add field org_id to assetpermission
    - Add field user_groups to assetpermission
    - Add field users to assetpermission
    - Alter field date_expired on assetpermission
    - Alter field name on assetpermission
    - Remove field asset_groups from assetpermission
    - Alter unique_together for assetpermission (1 constraint(s))
2018-09-28 10:30:20 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:20 [signals_handler DEBUG]   - fresh all settings
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
	HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
2018-09-28 10:30:21 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:21 [signals_handler DEBUG]   - fresh all settings
Traceback (most recent call last):
  File "../apps/manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 103, in handle
    loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
(py3) [root@ip-xxxx opt]# cd jumpserver
(py3) [root@ip-xxxx jumpserver]# ./jms restart -d
Stop service: gunicorn
Stop service: celery
Stop service: beat
Fri Sep 28 02:30:44 2018
Jumpserver version 1.4.1, more see https://www.jumpserver.org

- Start Gunicorn WSGI HTTP Server
Check database structure change ...
2018-09-28 10:30:45 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:45 [signals_handler DEBUG]   - fresh all settings
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
	HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
Traceback (most recent call last):
  File "manage.py", line 28, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/opt/py3/lib/python3.6/site-packages/django/db/migrations/loader.py", line 294, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration audits.0001_initial is applied before its dependency users.0003_auto_20180928_1030 on database 'default'.
Collect static files
2018-09-28 10:30:47 [signals_handler DEBUG] Receive django ready signal
2018-09-28 10:30:47 [signals_handler DEBUG]   - fresh all settings

0 static files copied to '/opt/jumpserver/data/static', 451 unmodified.

- Start Celery as Distributed Task Queue

- Start Beat as Periodic Task Scheduler

gunicorn is running: 10096
celery is running: 10111
beat is running: 10114
@wojiushixiaobai

This comment has been minimized.

Show comment
Hide comment
@wojiushixiaobai

wojiushixiaobai Sep 28, 2018

Collaborator

@BigbigY 升级以前的表数据库结构文件检查没有?
就是升级文档的第0条,检查数据库表结构文件是否完整

Collaborator

wojiushixiaobai commented Sep 28, 2018

@BigbigY 升级以前的表数据库结构文件检查没有?
就是升级文档的第0条,检查数据库表结构文件是否完整

@BigbigY

This comment has been minimized.

Show comment
Hide comment
@BigbigY

BigbigY Sep 28, 2018

@wojiushixiaobai 升级前是一样的,现在导入数据库后,也把jumpserver目录升级成最新的了,现在看是不一样的

BigbigY commented Sep 28, 2018

@wojiushixiaobai 升级前是一样的,现在导入数据库后,也把jumpserver目录升级成最新的了,现在看是不一样的

@wojiushixiaobai

This comment has been minimized.

Show comment
Hide comment
@wojiushixiaobai

wojiushixiaobai Sep 30, 2018

Collaborator

@BigbigY 已验证,是数据库编码的问题
请确定数据库编码是utf-8
只能是uft-8

Collaborator

wojiushixiaobai commented Sep 30, 2018

@BigbigY 已验证,是数据库编码的问题
请确定数据库编码是utf-8
只能是uft-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment