-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
CoreEdgeClusterSettings.java
137 lines (114 loc) · 6.21 KB
/
CoreEdgeClusterSettings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Copyright (c) 2002-2016 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.coreedge.server;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.function.Function;
import org.neo4j.graphdb.config.Setting;
import org.neo4j.graphdb.factory.Description;
import static org.neo4j.helpers.Settings.BOOLEAN;
import static org.neo4j.helpers.Settings.DURATION;
import static org.neo4j.helpers.Settings.INTEGER;
import static org.neo4j.helpers.Settings.MANDATORY;
import static org.neo4j.helpers.Settings.TRUE;
import static org.neo4j.helpers.Settings.list;
import static org.neo4j.helpers.Settings.setting;
@Description("Settings for Core-Edge Clusters")
public class CoreEdgeClusterSettings
{
public static final Function<String, ListenSocketAddress> LISTEN_SOCKET_ADDRESS = new Function<String,
ListenSocketAddress>()
{
@Override
public ListenSocketAddress apply( String value )
{
String[] split = value.split( ":" );
return new ListenSocketAddress( new InetSocketAddress( split[0], Integer.valueOf( split[1] ) ) );
}
@Override
public String toString()
{
return "a socket address";
}
};
public static final Function<String, AdvertisedSocketAddress> ADVERTISED_SOCKET_ADDRESS = new Function<String,
AdvertisedSocketAddress>()
{
@Override
public AdvertisedSocketAddress apply( String value )
{
String[] split = value.split( ":" );
return new AdvertisedSocketAddress( new InetSocketAddress( split[0], Integer.valueOf( split[1] ) ) );
}
@Override
public String toString()
{
return "a socket address";
}
};
@Description("Time out for a new member to catch up")
public static final Setting<Long> join_catch_up_timeout =
setting( "core_edge.join_catch_up_timeout", DURATION, "10m" );
@Description("Leader election timeout")
public static final Setting<Long> leader_election_timeout =
setting( "core_edge.leader_election_timeout", DURATION, "500ms" );
@Description("Leader wait timeout")
public static final Setting<Long> leader_wait_timeout =
setting( "core_edge.leader_wait_timeout", DURATION, "30s" );
@Description("The maximum batch size when catching up (in unit of entries)")
public static final Setting<Integer> catchup_batch_size =
setting( "core_edge.catchup_batch_size", INTEGER, "64" );
@Description("The maximum lag allowed before log shipping pauses (in unit of entries)")
public static final Setting<Integer> log_shipping_max_lag =
setting( "core_edge.log_shipping_max_lag", INTEGER, "256" );
@Description("The time between successive retries of replicating a transaction")
public static final Setting<Long> tx_replication_retry_interval =
setting( "core_edge.tx_replication_retry_interval", DURATION, "1s" );
@Description("Expected size of core cluster")
public static final Setting<Integer> expected_core_cluster_size =
setting( "core_edge.expected_core_cluster_size", INTEGER, "3" );
@Description("Timeout for taking remote (write) locks on slaves. Defaults to ha.read_timeout.")
public static final Setting<Long> lock_read_timeout =
setting( "core_edge.lock_read_timeout", DURATION, "20s" );
@Description("Network interface and port for the RAFT server to listen on.")
public static final Setting<ListenSocketAddress> transaction_listen_address =
setting( "core_edge.transaction_listen_address", LISTEN_SOCKET_ADDRESS, "0.0.0.0:6001" );
@Description("Hostname/IP address and port that other RAFT servers can use to communicate with us.")
public static final Setting<AdvertisedSocketAddress> transaction_advertised_address =
setting( "core_edge.transaction_advertised_address", ADVERTISED_SOCKET_ADDRESS, "localhost:6001" );
@Description("Network interface and port for the RAFT server to listen on.")
public static final Setting<ListenSocketAddress> raft_listen_address =
setting( "core_edge.raft_listen_address", LISTEN_SOCKET_ADDRESS, "0.0.0.0:7400" );
@Description("Hostname/IP address and port that other RAFT servers can use to communicate with us.")
public static final Setting<AdvertisedSocketAddress> raft_advertised_address =
setting( "core_edge.raft_advertised_address", ADVERTISED_SOCKET_ADDRESS, "localhost:7400" );
@Description("Host and port to bind the cluster management communication.")
public static final Setting<ListenSocketAddress> cluster_listen_address =
setting( "core_edge.cluster_listen_address", LISTEN_SOCKET_ADDRESS, "0.0.0.0:5001" );
@Description("A comma-separated list of other members of the cluster to join.")
public static final Setting<List<AdvertisedSocketAddress>> initial_core_cluster_members =
setting( "core_edge.initial_core_cluster_members", list( ",", ADVERTISED_SOCKET_ADDRESS ), MANDATORY );
@Description("Prevents the network middleware from dumping its own logs. Defaults to true.")
public static final Setting<Boolean> disable_middleware_logging =
setting( "core_edge.disable_middleware_logging", BOOLEAN, TRUE );
@Description("The maximum file size before the id allocation store is rotated (in unit of entries)")
public static final Setting<Integer> id_alloc_store_size = setting( "core_edge.id_alloc_store_size", INTEGER,
"1000" );
}