migrate-tool.asciidoc 3.8 KB

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