Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CCR to new ES JS client. #100131

Merged
merged 7 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions x-pack/plugins/cross_cluster_replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

You can run a local cluster and simulate a remote cluster within a single Kibana directory.

1. Start your "local" cluster by running `yarn es snapshot --license=trial` and `yarn start` to start Kibana.
2. Start your "remote" cluster by running `yarn es snapshot --license=trial -E cluster.name=europe -E transport.port=9400` in a separate terminal tab.
3. Index a document into your remote cluster by running `curl -X PUT http://elastic:changeme@localhost:9201/my-leader-index --data '{"settings":{"number_of_shards":1,"soft_deletes.enabled":true}}' --header "Content-Type: application/json"`.
Note that these settings are required for testing auto-follow pattern conflicts errors (see below).
1. Ensure Kibana isn't running so it doesn't load up any data into your cluster. Run `yarn es snapshot --license=trial` to install a fresh snapshot. Wait for ES to finish setting up.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuliacech I believe you wrote these originally, but I wasn't able to get the original instructions to work. Can you check this and see if I was just doing it wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating those instructions, @cjcenizal! I can confirm that the previous instructions didn't work for me either, tested your steps and it worked like a charm 👍

2. Create a "remote" copy of your ES snapshot by running: `cp -R .es/8.0.0 .es/8.0.0-2`.
4. Start your "remote" cluster by running `.es/8.0.0-2/bin/elasticsearch -E cluster.name=europe -E transport.port=9400`.
4. Run `yarn start` to start Kibana.
5. Index a document into your remote cluster by running `curl -X PUT http://elastic:changeme@localhost:9201/my-leader-index --data '{"settings":{"number_of_shards":1,"soft_deletes.enabled":true}}' --header "Content-Type: application/json"`. Note that these settings are required for testing auto-follow pattern conflicts errors (see below).

Now you can create follower indices and auto-follow patterns to replicate the `my-leader-index`
index on the remote cluster that's available at `127.0.0.1:9400`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ import { EuiCallOut, EuiSpacer } from '@elastic/eui';
export function SectionError(props) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll migrate this to use our shared SectionError as part of #84801

const { title, error, ...rest } = props;
const data = error.body ? error.body : error;
const {
error: errorString,
attributes, // wrapEsError() on the server add a "cause" array
message,
} = data;
const { error: errorString, attributes, message } = data;

return (
<EuiCallOut title={title} color="danger" iconType="alert" {...rest}>
<div>{message || errorString}</div>
{attributes && attributes.cause && (
{attributes?.error?.root_cause && (
<Fragment>
<EuiSpacer size="m" />
<ul>
{attributes.cause.map((message, i) => (
<li key={i}>{message}</li>
{attributes.error.root_cause.map(({ type, reason }, i) => (
<li key={i}>
{type}: {reason}
</li>
))}
</ul>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,24 @@ export class AutoFollowPatternEdit extends PureComponent {
params: { id: name },
},
} = this.props;

const title = i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternEditForm.loadingErrorTitle',
{
defaultMessage: 'Error loading auto-follow pattern',
}
);

const errorMessage =
error.status === 404
error.body.statusCode === 404
? {
data: {
error: i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternEditForm.loadingErrorMessage',
{
defaultMessage: `The auto-follow pattern '{name}' does not exist.`,
values: { name },
}
),
},
error: i18n.translate(
'xpack.crossClusterReplication.autoFollowPatternEditForm.loadingErrorMessage',
{
defaultMessage: `The auto-follow pattern '{name}' does not exist.`,
values: { name },
}
),
}
: error;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,24 @@ export class FollowerIndexEdit extends PureComponent {
params: { id: name },
},
} = this.props;

const title = i18n.translate(
'xpack.crossClusterReplication.followerIndexEditForm.loadingErrorTitle',
{
defaultMessage: 'Error loading follower index',
}
);

const errorMessage =
error.status === 404
error.body.statusCode === 404
? {
data: {
error: i18n.translate(
'xpack.crossClusterReplication.followerIndexEditForm.loadingErrorMessage',
{
defaultMessage: `The follower index '{name}' does not exist.`,
values: { name },
}
),
},
error: i18n.translate(
'xpack.crossClusterReplication.followerIndexEditForm.loadingErrorMessage',
{
defaultMessage: `The follower index '{name}' does not exist.`,
values: { name },
}
),
}
: error;

Expand Down

This file was deleted.

This file was deleted.

Loading