I have looked through https://www.postgresql.org/docs/9.6/static/pgupgrade.htmlbut it seems more complicated than necessary.
It went very good but took 100 minutes - where we had downtime - not so good.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных