mirror of https://github.com/apache/cassandra
Allow sstableloader to use SSL on the native port.
This commit is contained in:
parent
9eab2633cc
commit
c7a8730447
|
|
@ -1,4 +1,5 @@
|
|||
3.11.7
|
||||
* Allow sstableloader to use SSL on the native port (CASSANDRA-14904)
|
||||
Merged from 3.0:
|
||||
* Run evictFromMembership in GossipStage (CASSANDRA-15592)
|
||||
Merged from 2.2:
|
||||
|
|
|
|||
|
|
@ -374,10 +374,6 @@ public class LoaderOptions
|
|||
config.inter_dc_stream_throughput_outbound_megabits_per_sec = 0;
|
||||
}
|
||||
|
||||
if (cmd.hasOption(NATIVE_PORT_OPTION))
|
||||
nativePort = Integer.parseInt(cmd.getOptionValue(NATIVE_PORT_OPTION));
|
||||
else
|
||||
nativePort = config.native_transport_port;
|
||||
if (cmd.hasOption(STORAGE_PORT_OPTION))
|
||||
storagePort = Integer.parseInt(cmd.getOptionValue(STORAGE_PORT_OPTION));
|
||||
else
|
||||
|
|
@ -406,6 +402,18 @@ public class LoaderOptions
|
|||
clientEncOptions.enabled = true;
|
||||
}
|
||||
|
||||
if (cmd.hasOption(NATIVE_PORT_OPTION))
|
||||
{
|
||||
nativePort = Integer.parseInt(cmd.getOptionValue(NATIVE_PORT_OPTION));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config.native_transport_port_ssl != null && (config.client_encryption_options.enabled || clientEncOptions.enabled))
|
||||
nativePort = config.native_transport_port_ssl;
|
||||
else
|
||||
nativePort = config.native_transport_port;
|
||||
}
|
||||
|
||||
if (cmd.hasOption(SSL_TRUSTSTORE))
|
||||
{
|
||||
clientEncOptions.truststore = cmd.getOptionValue(SSL_TRUSTSTORE);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# Warning!
|
||||
# Consider the effects on 'o.a.c.i.s.LegacySSTableTest' before changing schemas in this file.
|
||||
#
|
||||
cluster_name: Test Cluster
|
||||
# memtable_allocation_type: heap_buffers
|
||||
memtable_allocation_type: offheap_objects
|
||||
commitlog_sync: batch
|
||||
commitlog_sync_batch_window_in_ms: 1.0
|
||||
commitlog_segment_size_in_mb: 5
|
||||
commitlog_directory: build/test/cassandra/commitlog
|
||||
cdc_raw_directory: build/test/cassandra/cdc_raw
|
||||
cdc_enabled: false
|
||||
hints_directory: build/test/cassandra/hints
|
||||
partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner
|
||||
listen_address: 127.0.0.1
|
||||
storage_port: 7010
|
||||
rpc_port: 9170
|
||||
start_native_transport: true
|
||||
native_transport_port_ssl: 9142
|
||||
column_index_size_in_kb: 4
|
||||
saved_caches_directory: build/test/cassandra/saved_caches
|
||||
data_file_directories:
|
||||
- build/test/cassandra/data
|
||||
disk_access_mode: mmap
|
||||
seed_provider:
|
||||
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
|
||||
parameters:
|
||||
- seeds: "127.0.0.1"
|
||||
endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch
|
||||
dynamic_snitch: true
|
||||
request_scheduler: org.apache.cassandra.scheduler.RoundRobinScheduler
|
||||
request_scheduler_id: keyspace
|
||||
server_encryption_options:
|
||||
internode_encryption: none
|
||||
keystore: conf/.keystore
|
||||
keystore_password: cassandra
|
||||
truststore: conf/.truststore
|
||||
truststore_password: cassandra
|
||||
incremental_backups: true
|
||||
concurrent_compactors: 4
|
||||
compaction_throughput_mb_per_sec: 0
|
||||
row_cache_class_name: org.apache.cassandra.cache.OHCProvider
|
||||
row_cache_size_in_mb: 16
|
||||
enable_user_defined_functions: true
|
||||
enable_scripted_user_defined_functions: true
|
||||
prepared_statements_cache_size_mb: 1
|
||||
client_encryption_options:
|
||||
enabled: true
|
||||
# If enabled and optional is set to true encrypted and unencrypted connections are handled.
|
||||
optional: false
|
||||
keystore: conf/cassandra_ssl_test.keystore
|
||||
keystore_password: cassandra
|
||||
# require_client_auth: false
|
||||
# Set trustore and truststore_password if require_client_auth is true
|
||||
truststore: conf/cassandra_ssl_test.truststore
|
||||
truststore_password: cassandra
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cassandra.tools;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
|
||||
import static org.apache.cassandra.tools.ToolsTester.sstableDirName;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
// LoaderOptionsTester for custom configuration
|
||||
public class LoaderOptionsTest
|
||||
{
|
||||
@Test
|
||||
public void testNativePort() throws Exception {
|
||||
//Default Cassandra config
|
||||
File config = Paths.get(".", "test", "conf", "cassandra.yaml").normalize().toFile();
|
||||
String[] args = {"-d", "127.9.9.1", "-f", config.getAbsolutePath(), sstableDirName("legacy_sstables", "legacy_ma_simple")};
|
||||
LoaderOptions options = LoaderOptions.builder().parseArgs(args).build();
|
||||
assertEquals(9042, options.nativePort);
|
||||
|
||||
|
||||
// SSL Enabled Cassandra config
|
||||
config = Paths.get(".", "test", "conf", "unit-test-conf/test-native-port.yaml").normalize().toFile();
|
||||
String[] args2 = {"-d", "127.9.9.1", "-f", config.getAbsolutePath(), sstableDirName("legacy_sstables", "legacy_ma_simple")};
|
||||
options = LoaderOptions.builder().parseArgs(args2).build();
|
||||
assertEquals(9142, options.nativePort);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue