| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 | [role="xpack"][testenv="gold+"][[migrate-tool]]== elasticsearch-migrateThe `elasticsearch-migrate` command migrates existing file-based users and rolesto the native realm. From 5.0 onward, you should use the `native` realm tomanage roles and local users.[float]=== Synopsis[source,shell]--------------------------------------------------bin/elasticsearch-migrate(native (-U, --url <url>)[-h, --help] [-E <KeyValuePair>][-n, --users <uids>] [-r, --roles <roles>][-u, --username <uid>] [-p, --password <password>][-s, --silent] [-v, --verbose])--------------------------------------------------[float]=== DescriptionNOTE: When migrating from Shield 2.x, the `elasticsearch-migrate` tool should berun prior to upgrading to ensure all roles can be migrated as some may be in adeprecated format that {xpack} cannot read. The `migrate` tool is available inShield 2.4.0 and higher.The `elasticsearch-migrate` tool loads the existing file-based users and rolesand calls the user and roles APIs to add them to the native realm. You canmigrate all users and roles, or specify the ones you want to migrate. Users androles that already exist in the `native` realm are not replaced oroverridden. If the names you specify with the `--users` and `--roles` optionsdon't exist in the `file` realm, they are skipped.[float][[migrate-tool-options]]=== ParametersThe `native` subcommand supports the following options:`-E <KeyValuePair>`::Configures a setting.`-h, --help`::Returns all of the command parameters.`-n`, `--users`::Comma-separated list of the users that you want to migrate. If this parameter isnot specified, all users are migrated.`-p`, `--password`::Password to use for authentication with {es}.//TBD: What is the default if this isn't specified?`-r`, `--roles`::Comma-separated list of the roles that you want to migrate. If this parameter isnot specified, all roles are migrated.`-s, --silent`:: Shows minimal output.`-U`, `--url`::Endpoint URL of the {es} cluster to which you want to migrate thefile-based users and roles. This parameter is required.`-u`, `--username`::Username to use for authentication with {es}.//TBD: What is the default if this isn't specified?`-v, --verbose`:: Shows verbose output.[float]=== ExamplesRun the `elasticsearch-migrate` tool when {xpack} is installed. For example:[source, sh]----------------------------------------------------------------------$ bin/elasticsearch-migrate native -U http://localhost:9200 -u elastic-p x-pack-test-password -n lee,foo -r role1,role2,role3,role4,foostarting migration of users and roles...importing users from [/home/es/config/shield/users]...found existing users: [test_user, joe3, joe2]migrating user [lee]{"user":{"created":true}}no user [foo] found, skippingimporting roles from [/home/es/config/shield/roles.yml]...found existing roles: [marvel_user, role_query_fields, admin_role, role3, admin,remote_marvel_agent, power_user, role_new_format_name_array, role_run_as,logstash, role_fields, role_run_as1, role_new_format, kibana4_server, user,transport_client, role1.ab, role_query]migrating role [role1]{"role":{"created":true}}migrating role [role2]{"role":{"created":true}}role [role3] already exists, skippingno role [foo] found, skippingusers and roles imported.----------------------------------------------------------------------Additionally, the `-E` flag can be used to specify additional settings. For exampleto specify a different configuration directory, the command would look like:[source, sh]----------------------------------------------------------------------$ bin/elasticsearch-migrate native -U http://localhost:9200 -u elastic-p x-pack-test-password -E path.conf=/etc/elasticsearch----------------------------------------------------------------------
 |