Issue when restoring erpnext backup

I just running restore command

bench restore SQL_FILE_PATH

and when I try to go to my localhost a message pop up telling me this Screenshot_2018-07-11%20Updating

Anyone knows what happened?

please wait for the restore to complete and start bench again. Use bench --site <sitename> migrate if required

If you restored database from old version, you need to run patches.

Run
bench migrate command.

this morning I try using bench --site site1.local migrate and the output is error with this message

migrate
Migrating site1.local
Executing frappe.patches.v11_0.rename_standard_reply_to_email_template in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/commands/site.py", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/migrate.py", line 39, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/patches/v11_0/rename_standard_reply_to_email_template.py", line 6, in execute
    rename_doc('DocType', 'Standard Reply', 'Email Template')
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/model/rename_doc.py", line 52, in rename_doc
    update_user_settings(old, new, link_fields)
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/model/rename_doc.py", line 95, in update_user_settings
    sync_user_settings()
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/model/utils/user_settings.py", line 49, in sync_user_settings
    for key, data in iteritems(frappe.cache().hgetall('_user_settings')):
  File "/home/ubuntudekstop/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 153, in hgetall
    iteritems(super(redis.Redis, self).hgetall(self.make_key(name)))}
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py", line 1967, in hgetall
    return self.execute_command('HGETALL', name)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py", line 673, in execute_command
    connection.send_command(*args)
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 610, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 585, in send_packed_command
    self.connect()
  File "/home/ubuntudekstop/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 489, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

Trying updating bench but the error stil occure. any solution @root13F @kolate_sambhaji

Is you bench in production mode ?

If not then do $bench start in one terminal window and $bench migrate in other Similar error happened with me once this fixed the issue.

If its in production mode restart the services :

$ sudo service supervisor restart 
$sudo service nginx restart

and then after starting in production do $ bench migrate

Point is make sure bench is started when you do bench migrate here as somehow it seems to be using the redis ports while doing migrate.

Let me know if this works for you…

regards,

Parth Joshi

1 Like

Thanks @joshiparthin it works well. Doesn’t know that migrate should be do when bench started.

Cool. @ezraluandre I am glad it worked. I faced same issue couple of days before.

You were in production or development mode ?

Yeah… not sure why bench is required to be start when bench migrate is done. But it is trying to communicate with cache, may be migrate is also updating the cache data along with DB structure hence it must be reaching out to Redis. Not sure…

Regards,

parth

@joshiparthin I think I’m in production mode, not sure but i think it is. I do manual installation since I’m using ubuntu 18.04 and there isn’t any choice to choose between production or development mode.