diff --git a/docs/plugins/discovery-ec2.asciidoc b/docs/plugins/discovery-ec2.asciidoc index aab1a4fffe1..7116c4b323d 100644 --- a/docs/plugins/discovery-ec2.asciidoc +++ b/docs/plugins/discovery-ec2.asciidoc @@ -133,8 +133,9 @@ with the right signer to use. ===== Read timeout Read timeout determines the amount of time to wait for data to be transferred over an established, -open connection before the connection is timed out. By default,it is set to 50 seconds. -It can be configured with `cloud.aws.read_timeout` setting: +open connection before the connection is timed out. +It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.ec2.read_timeout`) setting: + [source, yaml] ---- cloud.aws.read_timeout: 30s @@ -188,12 +189,6 @@ The following are a list of settings (prefixed with `discovery.ec2`) that can fu How long the list of hosts is cached to prevent further requests to the AWS API. Defaults to `10s`. -`read_timeout`:: - - The amount of time to wait for data to be transferred over an established, - open connection before the connection is timed out. Default to value of `cloud.aws.read_timeout`. - - [IMPORTANT] .Binding the network host ============================================== diff --git a/docs/plugins/repository-s3.asciidoc b/docs/plugins/repository-s3.asciidoc index 156c8dbc5e8..f568c17dcde 100644 --- a/docs/plugins/repository-s3.asciidoc +++ b/docs/plugins/repository-s3.asciidoc @@ -141,8 +141,9 @@ use `S3SignerType`, which is Signature Version 2. ===== Read timeout Read timeout determines the amount of time to wait for data to be transferred over an established, -open connection before the connection is timed out. By default,it is set to 50 seconds. -It can be configured with `cloud.aws.read_timeout` setting: +open connection before the connection is timed out. +It can be configured with `cloud.aws.read_timeout` (or `cloud.aws.s3.read_timeout`) setting: + [source, yaml] ---- cloud.aws.read_timeout: 30s @@ -264,12 +265,6 @@ The following settings are supported: The default behaviour is to detect which access style to use based on the configured endpoint (an IP will result in path-style access) and the bucket being accessed (some buckets are not valid DNS names). - -`read_timeout`:: - - The amount of time to wait for data to be transferred over an established, - open connection before the connection is timed out. Default to value of `cloud.aws.read_timeout`. - Note that you can define S3 repository settings for all S3 repositories in `elasticsearch.yml` configuration file. They are all prefixed with `repositories.s3.`. For example, you can define compression for all S3 repositories by setting `repositories.s3.compress: true` in `elasticsearch.yml`. diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java index db09c1a91bf..20c6398fbc2 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java @@ -83,7 +83,7 @@ public interface AwsEc2Service { /** * cloud.aws.read_timeout: Socket read timeout. Shared with repository-s3 plugin */ - Setting READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.timeValueSeconds(50), + Setting READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE, Property.NodeScope, Property.Shared); /** diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java index 262334c3fa7..e35be7332c2 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java @@ -125,7 +125,10 @@ public class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Servic 10, false); clientConfiguration.setRetryPolicy(retryPolicy); - clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis()); + + if (READ_TIMEOUT.exists(settings) || CLOUD_EC2.READ_TIMEOUT.exists(settings)) { + clientConfiguration.setSocketTimeout((int) CLOUD_EC2.READ_TIMEOUT.get(settings).millis()); + } return clientConfiguration; } diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java index 8e7a6637b38..d6284a0faed 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java @@ -72,7 +72,8 @@ public class AwsEc2ServiceImplTests extends ESTestCase { } public void testAWSDefaultConfiguration() { - launchAWSConfigurationTest(Settings.EMPTY, Protocol.HTTPS, null, -1, null, null, null, 50000); + launchAWSConfigurationTest(Settings.EMPTY, Protocol.HTTPS, null, -1, null, null, null, + ClientConfiguration.DEFAULT_SOCKET_TIMEOUT); } public void testAWSConfigurationWithAwsSettings() { diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java index 713488797f4..93996ce248a 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java @@ -80,7 +80,7 @@ public interface AwsS3Service extends LifecycleComponent { /** * cloud.aws.read_timeout: Socket read timeout. Shared with discovery-ec2 plugin */ - Setting READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.timeValueSeconds(50), + Setting READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", TimeValue.MINUS_ONE, Property.NodeScope, Property.Shared); /** diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java index 5ecd5f507ad..cdb5e812905 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java @@ -116,7 +116,9 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent implements AwsSigner.configureSigner(awsSigner, clientConfiguration, endpoint); } - clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis()); + if (READ_TIMEOUT.exists(settings) || CLOUD_S3.READ_TIMEOUT.exists(settings)) { + clientConfiguration.setSocketTimeout((int) CLOUD_S3.READ_TIMEOUT.get(settings).millis()); + } return clientConfiguration; } diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java index 8d65104b07e..2bd14847f7e 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java @@ -143,7 +143,8 @@ public class AwsS3ServiceImplTests extends ESTestCase { public void testAWSDefaultConfiguration() { Settings repositorySettings = generateRepositorySettings(null, null, "eu-central", null, null); - launchAWSConfigurationTest(Settings.EMPTY, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 3, false, 50000); + launchAWSConfigurationTest(Settings.EMPTY, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 3, false, + ClientConfiguration.DEFAULT_SOCKET_TIMEOUT); } public void testAWSConfigurationWithAwsSettings() {