migrate-tool.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. [role="xpack"]
  2. [testenv="gold+"]
  3. [[migrate-tool]]
  4. == elasticsearch-migrate
  5. The `elasticsearch-migrate` command migrates existing file-based users and roles
  6. to the native realm. From 5.0 onward, you should use the `native` realm to
  7. manage roles and local users.
  8. [float]
  9. === Synopsis
  10. [source,shell]
  11. --------------------------------------------------
  12. bin/elasticsearch-migrate
  13. (native (-U, --url <url>)
  14. [-h, --help] [-E <KeyValuePair>]
  15. [-n, --users <uids>] [-r, --roles <roles>]
  16. [-u, --username <uid>] [-p, --password <password>]
  17. [-s, --silent] [-v, --verbose])
  18. --------------------------------------------------
  19. [float]
  20. === Description
  21. NOTE: When migrating from Shield 2.x, the `elasticsearch-migrate` tool should be
  22. run prior to upgrading to ensure all roles can be migrated as some may be in a
  23. deprecated format that {xpack} cannot read. The `migrate` tool is available in
  24. Shield 2.4.0 and higher.
  25. The `elasticsearch-migrate` tool loads the existing file-based users and roles
  26. and calls the user and roles APIs to add them to the native realm. You can
  27. migrate all users and roles, or specify the ones you want to migrate. Users and
  28. roles that already exist in the `native` realm are not replaced or
  29. overridden. If the names you specify with the `--users` and `--roles` options
  30. don't exist in the `file` realm, they are skipped.
  31. [float]
  32. [[migrate-tool-options]]
  33. === Parameters
  34. The `native` subcommand supports the following options:
  35. `-E <KeyValuePair>`::
  36. Configures a setting.
  37. `-h, --help`::
  38. Returns all of the command parameters.
  39. `-n`, `--users`::
  40. Comma-separated list of the users that you want to migrate. If this parameter is
  41. not specified, all users are migrated.
  42. `-p`, `--password`::
  43. Password to use for authentication with {es}.
  44. //TBD: What is the default if this isn't specified?
  45. `-r`, `--roles`::
  46. Comma-separated list of the roles that you want to migrate. If this parameter is
  47. not specified, all roles are migrated.
  48. `-s, --silent`:: Shows minimal output.
  49. `-U`, `--url`::
  50. Endpoint URL of the {es} cluster to which you want to migrate the
  51. file-based users and roles. This parameter is required.
  52. `-u`, `--username`::
  53. Username to use for authentication with {es}.
  54. //TBD: What is the default if this isn't specified?
  55. `-v, --verbose`:: Shows verbose output.
  56. [float]
  57. === Examples
  58. Run the `elasticsearch-migrate` tool when {xpack} is installed. For example:
  59. [source, sh]
  60. ----------------------------------------------------------------------
  61. $ bin/elasticsearch-migrate native -U http://localhost:9200 -u elastic
  62. -p x-pack-test-password -n lee,foo -r role1,role2,role3,role4,foo
  63. starting migration of users and roles...
  64. importing users from [/home/es/config/shield/users]...
  65. found existing users: [test_user, joe3, joe2]
  66. migrating user [lee]
  67. {"user":{"created":true}}
  68. no user [foo] found, skipping
  69. importing roles from [/home/es/config/shield/roles.yml]...
  70. found existing roles: [marvel_user, role_query_fields, admin_role, role3, admin,
  71. remote_marvel_agent, power_user, role_new_format_name_array, role_run_as,
  72. logstash, role_fields, role_run_as1, role_new_format, kibana4_server, user,
  73. transport_client, role1.ab, role_query]
  74. migrating role [role1]
  75. {"role":{"created":true}}
  76. migrating role [role2]
  77. {"role":{"created":true}}
  78. role [role3] already exists, skipping
  79. no role [foo] found, skipping
  80. users and roles imported.
  81. ----------------------------------------------------------------------
  82. Additionally, the `-E` flag can be used to specify additional settings. For example
  83. to specify a different configuration directory, the command would look like:
  84. [source, sh]
  85. ----------------------------------------------------------------------
  86. $ bin/elasticsearch-migrate native -U http://localhost:9200 -u elastic
  87. -p x-pack-test-password -E path.conf=/etc/elasticsearch
  88. ----------------------------------------------------------------------