-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
flags.go
1707 lines (1455 loc) · 51.4 KB
/
flags.go
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2015 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package cliflags
import (
"bytes"
"fmt"
"strings"
"github.com/cockroachdb/cockroach/pkg/build"
"github.com/cockroachdb/cockroach/pkg/docs"
"github.com/kr/text"
)
// FlagInfo contains the static information for a CLI flag and helper
// to format the description.
type FlagInfo struct {
// Name of the flag as used on the command line.
Name string
// Shorthand is the short form of the flag (optional).
Shorthand string
// EnvVar is the name of the environment variable through which the flag value
// can be controlled (optional).
EnvVar string
// Description of the flag.
//
// The text will be automatically re-wrapped. The wrapping can be stopped by
// embedding the tag "<PRE>": this tag is removed from the text and
// signals that everything that follows should not be re-wrapped. To start
// wrapping again, use "</PRE>".
Description string
}
const usageIndentation = 1
const wrapWidth = 79 - usageIndentation
// wrapDescription wraps the text in a FlagInfo.Description.
func wrapDescription(s string) string {
var result bytes.Buffer
// split returns the parts of the string before and after the first occurrence
// of the tag.
split := func(str, tag string) (before, after string) {
pieces := strings.SplitN(str, tag, 2)
switch len(pieces) {
case 0:
return "", ""
case 1:
return pieces[0], ""
default:
return pieces[0], pieces[1]
}
}
for len(s) > 0 {
var toWrap, dontWrap string
// Wrap everything up to the next stop wrap tag.
toWrap, s = split(s, "<PRE>")
result.WriteString(text.Wrap(toWrap, wrapWidth))
// Copy everything up to the next start wrap tag.
dontWrap, s = split(s, "</PRE>")
result.WriteString(dontWrap)
}
return result.String()
}
// Usage returns a formatted usage string for the flag, including:
// * line wrapping
// * indentation
// * env variable name (if set)
func (f FlagInfo) Usage() string {
s := "\n" + wrapDescription(f.Description)
if f.EnvVar != "" {
// Check that the environment variable name matches the flag name. Note: we
// don't want to automatically generate the name so that grepping for a flag
// name in the code yields the flag definition.
correctName := "COCKROACH_" + strings.ToUpper(strings.Replace(f.Name, "-", "_", -1))
if f.EnvVar != correctName {
panic(fmt.Sprintf("incorrect EnvVar %s for flag %s (should be %s)",
f.EnvVar, f.Name, correctName))
}
s = s + "\nEnvironment variable: " + f.EnvVar
}
// github.com/spf13/pflag appends the default value after the usage text. Add
// an additional indentation so the default is well-aligned with the
// rest of the text. This is admittedly fragile.
return text.Indent(s, strings.Repeat(" ", usageIndentation)) + "\n"
}
// Attrs and others store the static information for CLI flags.
var (
Attrs = FlagInfo{
Name: "attrs",
Description: `
An ordered, colon-separated list of node attributes. Attributes are arbitrary
strings specifying machine capabilities. Machine capabilities might include
specialized hardware or number of cores (e.g. "gpu", "x16c"). For example:
<PRE>
--attrs=x16c:gpu</PRE>`,
}
Locality = FlagInfo{
Name: "locality",
Description: `
An ordered, comma-separated list of key-value pairs that describe the topography
of the machine. Topography often includes cloud provider regions and availability
zones, but can also refer to on-prem concepts like datacenter or rack. Data is
automatically replicated to maximize diversities of each tier. The order of tiers
is used to determine the priority of the diversity, so the more inclusive localities
like region should come before less inclusive localities like availability zone. The
tiers and order must be the same on all nodes. Including more tiers is better than
including fewer. For example:
<PRE>
--locality=cloud=gce,region=us-west1,zone=us-west-1b
--locality=cloud=aws,region=us-east,zone=us-east-2</PRE>`,
}
Background = FlagInfo{
Name: "background",
Description: `
Start the server in the background. This is similar to appending "&"
to the command line, but when the server is started with --background,
control is not returned to the shell until the server is ready to
accept requests.`,
}
SQLMem = FlagInfo{
Name: "max-sql-memory",
Description: `
Maximum memory capacity available to store temporary data for SQL clients,
including prepared queries and intermediate data rows during query execution.
Accepts numbers interpreted as bytes, size suffixes (e.g. 1GB and 1GiB) or a
percentage of physical memory (e.g. .25). If left unspecified, defaults to 25% of
physical memory.`,
}
SQLTempStorage = FlagInfo{
Name: "max-disk-temp-storage",
Description: `
Maximum storage capacity available to store temporary disk-based data for SQL
queries that exceed the memory budget (e.g. join, sorts, etc are sometimes able
to spill intermediate results to disk). Accepts numbers interpreted as bytes,
size suffixes (e.g. 32GB and 32GiB) or a percentage of disk size (e.g. 10%). If
left unspecified, defaults to 32GiB.
<PRE>
</PRE>
The location of the temporary files is within the first store dir (see --store).
If expressed as a percentage, --max-disk-temp-storage is interpreted relative to
the size of the storage device on which the first store is placed. The temp
space usage is never counted towards any store usage (although it does share the
device with the first store) so, when configuring this, make sure that the size
of this temp storage plus the size of the first store don't exceed the capacity
of the storage device.
<PRE>
</PRE>
If the first store is an in-memory one (i.e. type=mem), then this temporary
"disk" data is also kept in-memory. A percentage value is interpreted as a
percentage of the available internal memory. If not specified, the default
shifts to 100MiB when the first store is in-memory.
`,
}
AuthTokenValidityPeriod = FlagInfo{
Name: "expire-after",
Description: `
Duration after which the newly created session token expires.`,
}
OnlyCookie = FlagInfo{
Name: "only-cookie",
Description: `
Display only the newly created cookie on the standard output
without additional details and decoration.`,
}
Cache = FlagInfo{
Name: "cache",
Description: `
Total size in bytes for caches, shared evenly if there are multiple
storage devices. Size suffixes are supported (e.g. 1GB and 1GiB).
If left unspecified, defaults to 128MiB. A percentage of physical memory
can also be specified (e.g. .25).`,
}
ClientHost = FlagInfo{
Name: "host",
EnvVar: "COCKROACH_HOST",
Description: `
CockroachDB node to connect to.
This can be specified either as an address/hostname, or
together with a port number as in -s myhost:26257.
If the port number is left unspecified, it defaults to 26257.
An IPv6 address can also be specified with the notation [...], for
example [::1]:26257 or [fe80::f6f2:::]:26257.`,
}
ClientPort = FlagInfo{
Name: "port",
Shorthand: "p",
EnvVar: "COCKROACH_PORT",
Description: `Deprecated. Use --host=<host>:<port>.`,
}
Database = FlagInfo{
Name: "database",
Shorthand: "d",
EnvVar: "COCKROACH_DATABASE",
Description: `The name of the database to connect to.`,
}
DumpMode = FlagInfo{
Name: "dump-mode",
Description: `
What to dump. "schema" dumps the schema only. "data" dumps the data only.
"both" (default) dumps the schema then the data.`,
}
ReadTime = FlagInfo{
Name: "as-of",
Description: `
Reads the data as of the specified timestamp. Formats supported are the same
as the timestamp type.`,
}
DumpAll = FlagInfo{
Name: "dump-all",
Description: `
Dumps all databases, for each non-system database provides dump of all available tables.`,
}
Execute = FlagInfo{
Name: "execute",
Shorthand: "e",
Description: `
Execute the SQL statement(s) on the command line, then exit. This flag may be
specified multiple times and each value may contain multiple semicolon
separated statements. If an error occurs in any statement, the command exits
with a non-zero status code and further statements are not executed. The
results of each SQL statement are printed on the standard output.
This flag is incompatible with --file / -f.`,
}
File = FlagInfo{
Name: "file",
Shorthand: "f",
Description: `
Read and execute the SQL statement(s) from the specified file.
The file is processed as if it has been redirected on the standard
input of the shell.
This flag is incompatible with --execute / -e.`,
}
Watch = FlagInfo{
Name: "watch",
Description: `
Repeat the SQL statement(s) specified with --execute
with the specified period. The client will stop watching
if an execution of the SQL statement(s) fail.`,
}
EchoSQL = FlagInfo{
Name: "echo-sql",
Description: `
Reveal the SQL statements sent implicitly by the command-line utility.`,
}
CliDebugMode = FlagInfo{
Name: "debug-sql-cli",
Description: `
Simplify the SQL CLI to ease troubleshooting of CockroachDB
issues. This echoes sent SQL, removes the database name and txn status
from the prompt, and forces behavior to become independent on current
transaction state. Equivalent to --echo-sql, \unset check_syntax and
\set prompt1 %n@%M>.`,
}
EmbeddedMode = FlagInfo{
Name: "embedded",
Description: `
Simplify and reduce the SQL CLI output to make it appropriate for
embedding in a 'playground'-type environment.
This causes the shell to omit informational message about
aspects that can only be changed with command-line flags
or environment variables: in an embedded environment, the user
has no control over these and the messages would thus be
confusing.
It also causes the shell to omit informational messages about
networking details (e.g. server address), as it is assumed
that the embedding environment will report those instead.`,
}
SafeUpdates = FlagInfo{
Name: "safe-updates",
Description: `
Disable SQL statements that may have undesired side effects. For
example a DELETE or UPDATE without a WHERE clause. By default, this
setting is enabled (true) and such statements are rejected to prevent
accidents. This can also be overridden in a session with SET
sql_safe_updates = FALSE.`,
}
ReadOnly = FlagInfo{
Name: "read-only",
Description: `
Set the session variable default_transaction_read_only to on.`,
}
Set = FlagInfo{
Name: "set",
Description: `
Set a client-side configuration parameter before running the SQL
shell. This flag may be specified multiple times.`,
}
TableDisplayFormat = FlagInfo{
Name: "format",
Description: `
Selects how to display table rows in results. Possible values: tsv,
csv, table, records, sql, raw, html. If left unspecified, defaults to
tsv for non-interactive sessions and table for interactive sessions.`,
}
ClusterName = FlagInfo{
Name: "cluster-name",
Description: `
Sets a name to verify the identity of a remote node or cluster. The value must
match between this node and the remote node(s) specified via --join.
<PRE>
</PRE>
This can be used as an additional verification when either the node or cluster,
or both, have not yet been initialized and do not yet know their cluster ID.
<PRE>
</PRE>
To introduce a cluster name into an already-initialized cluster, pair this flag
with --disable-cluster-name-verification.
`,
}
DisableClusterNameVerification = FlagInfo{
Name: "disable-cluster-name-verification",
Description: `
Tell the server to ignore cluster name mismatches. This is meant for use when
opting an existing cluster into starting to use cluster name verification, or
when changing the cluster name.
<PRE>
</PRE>
The cluster should be restarted once with --cluster-name and
--disable-cluster-name-verification combined, and once all nodes have
been updated to know the new cluster name, the cluster can be
restarted again with this flag removed.`,
}
Join = FlagInfo{
Name: "join",
Shorthand: "j",
Description: `
The addresses for connecting a node to a cluster.
<PRE>
</PRE>
When starting a multi-node cluster for the first time, set this flag
to the addresses of 3-5 of the initial nodes. Then run the cockroach
init command against one of the nodes to complete cluster startup.
<PRE>
</PRE>
When starting a singe-node cluster, leave this flag out. This will
cause the node to initialize a new single-node cluster without
needing to run the cockroach init command.
<PRE>
</PRE>
When adding a node to an existing cluster, set this flag to 3-5
of the nodes already in the cluster; it's easiest to use the same
list of addresses that was used to start the initial nodes.
<PRE>
</PRE>
This flag can be specified separately for each address:
<PRE>
--join=localhost:1234 --join=localhost:2345
</PRE>
Or can be specified as a comma separated list in single flag,
or both forms can be used together, for example:
<PRE>
--join=localhost:1234,localhost:2345 --join=localhost:3456</PRE>`,
}
JoinPreferSRVRecords = FlagInfo{
Name: "experimental-dns-srv",
Description: `
When enabled, the node will first attempt to fetch SRV records
from DNS for every name specified with --join. If a valid
SRV record is found, that information is used instead
of regular DNS A/AAAA lookups.
This feature is experimental and may be removed or modified
in a later version.`,
}
ListenAddr = FlagInfo{
Name: "listen-addr",
Description: `
The address/hostname and port to listen on for intra-cluster
communication, for example --listen-addr=myhost:26257 or
--listen-addr=:26257 (listen on all interfaces).
Unless --sql-addr is also specified, this address is also
used to accept SQL client connections.
<PRE>
</PRE>
If the address part is left unspecified, it defaults to
the "all interfaces" address (0.0.0.0 IPv4 / [::] IPv6).
If the port part is left unspecified, it defaults to 26257.
<PRE>
</PRE>
An IPv6 address can also be specified with the notation [...], for
example [::1]:26257 or [fe80::f6f2:::]:26257.
<PRE>
</PRE>
If --advertise-addr is left unspecified, the node will also announce
this address for use by other nodes. It is strongly recommended to use
--advertise-addr in cloud and container deployments or any setup where
NAT is present between cluster nodes.`,
}
ServerHost = FlagInfo{
Name: "host",
Description: `Alias for --listen-addr. Deprecated.`,
}
ServerPort = FlagInfo{
Name: "port",
Description: `Alias for --listen-port. Deprecated.`,
}
AdvertiseAddr = FlagInfo{
Name: "advertise-addr",
Description: `
The address/hostname and port to advertise to other CockroachDB nodes
for intra-cluster communication. It must resolve and be routable from
other nodes in the cluster.
<PRE>
</PRE>
If left unspecified, it defaults to the setting of --listen-addr.
If the flag is provided but either the address part or the port part
is left unspecified, that particular part defaults to the
same part in --listen-addr.
<PRE>
</PRE>
An IPv6 address can also be specified with the notation [...], for
example [::1]:26257 or [fe80::f6f2:::]:26257.
<PRE>
</PRE>
The port number should be the same as in --listen-addr unless port
forwarding is set up on an intermediate firewall/router.`,
}
AdvertiseHost = FlagInfo{
Name: "advertise-host",
Description: `Alias for --advertise-addr. Deprecated.`,
}
AdvertisePort = FlagInfo{
Name: "advertise-port",
Description: `Deprecated. Use --advertise-addr=<host>:<port>.`,
}
ListenSQLAddr = FlagInfo{
Name: "sql-addr",
Description: `
The hostname or IP address to bind to for SQL clients, for example
--sql-addr=myhost:26257 or --sql-addr=:26257 (listen on all interfaces).
If left unspecified, the address specified by --listen-addr will be
used for both RPC and SQL connections.
<PRE>
</PRE>
If specified but the address part is omitted, the address part
defaults to the address part of --listen-addr.
If specified but the port number is omitted, the port number
defaults to 26257.
<PRE>
</PRE>
To actually use separate bindings, it is recommended to specify
both flags and use a different port number via --listen-addr, for
example --sql-addr=:26257 --listen-addr=:26258. Ensure that
--join is set accordingly on other nodes. It is also possible
to use the same port number but separate host addresses.
<PRE>
</PRE>
An IPv6 address can also be specified with the notation [...], for
example [::1]:26257 or [fe80::f6f2:::]:26257.`,
}
SQLAdvertiseAddr = FlagInfo{
Name: "advertise-sql-addr",
Description: `
The SQL address/hostname and port to advertise to CLI admin utilities
and via SQL introspection for the purpose of SQL address discovery.
It must resolve and be routable from clients.
<PRE>
</PRE>
If left unspecified, it defaults to the setting of --sql-addr.
If the flag is provided but either the address part or the port part
is left unspecified, that particular part defaults to the
same part in --sql-addr.
<PRE>
</PRE>
An IPv6 address can also be specified with the notation [...], for
example [::1]:26257 or [fe80::f6f2:::]:26257.
<PRE>
</PRE>
The port number should be the same as in --sql-addr unless port
forwarding is set up on an intermediate firewall/router.`,
}
ListenMaxSQLConns = FlagInfo{
Name: "max-sql-conns",
Description: `
Maximum number of client SQL conns that can be open at a time on this node. If
left unspecified, there is no limit. This setting can be used to protect a
cluster against misconfiguration of client apps. For good security, a rate
limiter should be used in combination with this setting. Note that SQL admins
are not affected by (although they do contribute to) this limit.`,
}
ListenHTTPAddr = FlagInfo{
Name: "http-addr",
Description: `
The hostname or IP address to bind to for HTTP requests.
If left unspecified, the address part defaults to the setting of
--listen-addr. The port number defaults to 8080.
An IPv6 address can also be specified with the notation [...], for
example [::1]:8080 or [fe80::f6f2:::]:8080.`,
}
UnencryptedLocalhostHTTP = FlagInfo{
Name: "unencrypted-localhost-http",
Description: `
When specified, restricts HTTP connections to localhost-only and disables
TLS for the HTTP interface. The hostname part of --http-addr, if specified,
is then ignored. This flag is intended for use to facilitate
local testing without requiring certificate setups in web browsers.`,
}
AcceptSQLWithoutTLS = FlagInfo{
Name: "accept-sql-without-tls",
Description: `
When specified, this node will accept SQL client connections that do not wish
to negotiate a TLS handshake. Authentication is still otherwise required
as per the HBA configuration and all other security mechanisms continue to
apply. This flag is experimental.
`,
}
LocalityAdvertiseAddr = FlagInfo{
Name: "locality-advertise-addr",
Description: `
List of ports to advertise to other CockroachDB nodes for intra-cluster
communication for some locality. This should be specified as a comma
separated list of locality@address. Addresses can also include ports.
For example:
<PRE>
"[email protected]:26257,[email protected]:26258"</PRE>`,
}
ListenHTTPAddrAlias = FlagInfo{
Name: "http-host",
Description: `Alias for --http-addr. Deprecated.`,
}
ListenHTTPPort = FlagInfo{
Name: "http-port",
Description: `Deprecated. Use --http-addr=<host>:<port>.`,
}
ListeningURLFile = FlagInfo{
Name: "listening-url-file",
Description: `
After the CockroachDB node has started up successfully, it will
write its connection URL to the specified file.`,
}
PIDFile = FlagInfo{
Name: "pid-file",
Description: `
After the CockroachDB node has started up successfully, it will
write its process ID to the specified file.`,
}
Socket = FlagInfo{
Name: "socket",
EnvVar: "COCKROACH_SOCKET",
Description: `Deprecated in favor of --socket-dir.`,
}
SocketDir = FlagInfo{
Name: "socket-dir",
EnvVar: "COCKROACH_SOCKET_DIR",
Description: `
Accept client connections using a Unix domain socket created
in the specified directory.
Note: for compatibility with PostgreSQL clients and drivers,
the generated socket name has the form "/path/to/.s.PGSQL.NNNN",
where NNNN is the port number configured via --listen-addr.
PostgreSQL clients only take a port number and directory as input and construct
the socket name programmatically. To use, for example:
<PRE>
psql -h /path/to -p NNNN ...
</PRE>`,
}
ClientInsecure = FlagInfo{
Name: "insecure",
EnvVar: "COCKROACH_INSECURE",
Description: `
Connect to a cluster without using TLS nor authentication.
This makes the client-server connection vulnerable to MITM attacks. Use with care.`,
}
ServerInsecure = FlagInfo{
Name: "insecure",
Description: `
Start a node with all security controls disabled.
There is no encryption, no authentication and internal security
checks are also disabled. This makes any client able to take
over the entire cluster.
<PRE>
</PRE>
This flag is only intended for non-production testing.
<PRE>
</PRE>
Beware that using this flag on a public network without --listen-addr
is likely to cause the entire host server to become compromised.
<PRE>
</PRE>
To simply accept non-TLS connections for SQL clients while keeping
the cluster secure, consider using --accept-sql-without-tls instead.
Also see: ` + build.MakeIssueURL(53404) + `
`,
}
ExternalIODisableHTTP = FlagInfo{
Name: "external-io-disable-http",
Description: `Disable use of HTTP when accessing external data.`,
}
ExternalIODisableImplicitCredentials = FlagInfo{
Name: "external-io-disable-implicit-credentials",
Description: `
Disable use of implicit credentials when accessing external data.
Instead, require the user to always specify access keys.`,
}
ExternalIODisabled = FlagInfo{
Name: "external-io-disabled",
Description: `
Disable use of "external" IO, such as to S3, GCS, or the file system (nodelocal), or anything other than userfile.`,
}
ExternalIOEnableNonAdminImplicitAndArbitraryOutbound = FlagInfo{
Name: "external-io-enable-non-admin-implicit-access",
Description: `
Allow non-admin users to specify arbitrary network addressses (e.g. https:// URIs or custom endpoints in s3:// URIs) and
implicit credentials (machine account/role providers) when running operations like IMPORT/EXPORT/BACKUP/etc.
Note: that --external-io-disable-http or --external-io-disable-implicit-credentials still apply, this only removes the admin-user requirement.`,
}
// KeySize, CertificateLifetime, AllowKeyReuse, and OverwriteFiles are used for
// certificate generation functions.
KeySize = FlagInfo{
Name: "key-size",
Description: `Key size in bits for CA/Node/Client certificates.`,
}
CertificateLifetime = FlagInfo{
Name: "lifetime",
Description: `Certificate lifetime.`,
}
AllowCAKeyReuse = FlagInfo{
Name: "allow-ca-key-reuse",
Description: `Use the CA key if it exists.`,
}
OverwriteFiles = FlagInfo{
Name: "overwrite",
Description: `Certificate and key files are overwritten if they exist.`,
}
GeneratePKCS8Key = FlagInfo{
Name: "also-generate-pkcs8-key",
Description: `Also write the key in pkcs8 format to <certs-dir>/client.<username>.key.pk8.`,
}
Password = FlagInfo{
Name: "password",
Description: `Prompt for the new user's password.`,
}
InitToken = FlagInfo{
Name: "init-token",
Description: `Shared token for initialization of node TLS certificates.
This flag is optional for the 'start' command. When omitted, the 'start'
command expects the operator to prepare TLS certificates beforehand using
the 'cert' command.
This flag must be combined with --num-expected-initial-nodes.`,
}
NumExpectedInitialNodes = FlagInfo{
Name: "num-expected-initial-nodes",
Description: `Number of expected nodes during TLS certificate creation,
including the node where the connect command is run.
This flag must be combined with --init-token.`,
}
SingleNode = FlagInfo{
Name: "single-node",
Description: `Prepare the certificates for a subsequent 'start-single-node'
command. The 'connect' command only runs cursory checks on the network
configuration and does not wait for peers to auto-negotiate a common
set of credentials.
The --single-node flag is exclusive with the --init-num-peers and --init-token
flags.`,
}
CertsDir = FlagInfo{
Name: "certs-dir",
EnvVar: "COCKROACH_CERTS_DIR",
Description: `Path to the directory containing SSL certificates and keys.`,
}
// Server version of the certs directory flag, cannot be set through environment.
ServerCertsDir = FlagInfo{
Name: "certs-dir",
Description: CertsDir.Description,
}
CertPrincipalMap = FlagInfo{
Name: "cert-principal-map",
Description: `
A comma separated list of <cert-principal>:<db-principal> mappings. This allows
mapping the principal in a cert to a DB principal such as "node" or "root" or
any SQL user. This is intended for use in situations where the certificate
management system places restrictions on the Subject.CommonName or
SubjectAlternateName fields in the certificate (e.g. disallowing a CommonName
such as "node" or "root"). If multiple mappings are provided for the same
<cert-principal>, the last one specified in the list takes precedence. A
principal not specified in the map is passed through as-is via the identity
function. A cert is allowed to authenticate a DB principal if the DB principal
name is contained in the mapped CommonName or DNS-type SubjectAlternateName
fields. It is permissible for the <cert-principal> string to contain colons.
`,
}
CAKey = FlagInfo{
Name: "ca-key",
EnvVar: "COCKROACH_CA_KEY",
Description: `Path to the CA key.`,
}
ClockDevice = FlagInfo{
Name: "clock-device",
Description: `
Override HLC to use PTP hardware clock user space API when querying for current
time. The value corresponds to the clock device to be used. This is currently
only tested and supported on Linux.
<PRE>
--clock-device=/dev/ptp0</PRE>`,
}
MaxOffset = FlagInfo{
Name: "max-offset",
Description: `
Maximum allowed clock offset for the cluster. If observed clock offsets exceed
this limit, servers will crash to minimize the likelihood of reading
inconsistent data. Increasing this value will increase the time to recovery of
failures as well as the frequency of uncertainty-based read restarts.
<PRE>
</PRE>
Note that this value must be the same on all nodes in the cluster. In order to
change it, all nodes in the cluster must be stopped simultaneously and restarted
with the new value.`,
}
Store = FlagInfo{
Name: "store",
Shorthand: "s",
Description: `
The file path to a storage device. This flag must be specified separately for
each storage device, for example:
<PRE>
--store=/mnt/ssd01 --store=/mnt/ssd02 --store=/mnt/hda1
</PRE>
For each store, the "attrs" and "size" fields can be used to specify device
attributes and a maximum store size (see below). When one or both of these
fields are set, the "path" field label must be used for the path to the storage
device, for example:
<PRE>
--store=path=/mnt/ssd01,attrs=ssd,size=20GiB
</PRE>
In most cases, node-level attributes are preferable to store-level attributes.
However, the "attrs" field can be used to match capabilities for storage of
individual databases or tables. For example, an OLTP database would probably
want to allocate space for its tables only on solid state devices, whereas
append-only time series might prefer cheaper spinning drives. Typical
attributes include whether the store is flash (ssd), spinny disk (hdd), or
in-memory (mem), as well as speeds and other specs. Attributes can be arbitrary
strings separated by colons, for example:
<PRE>
--store=path=/mnt/hda1,attrs=hdd:7200rpm
</PRE>
The store size in the "size" field is not a guaranteed maximum but is used when
calculating free space for rebalancing purposes. The size can be specified
either in a bytes-based unit or as a percentage of hard drive space,
for example:
<PRE>
--store=path=/mnt/ssd01,size=10000000000 -> 10000000000 bytes
--store=path=/mnt/ssd01,size=20GB -> 20000000000 bytes
--store=path=/mnt/ssd01,size=20GiB -> 21474836480 bytes
--store=path=/mnt/ssd01,size=0.02TiB -> 21474836480 bytes
--store=path=/mnt/ssd01,size=20% -> 20% of available space
--store=path=/mnt/ssd01,size=0.2 -> 20% of available space
--store=path=/mnt/ssd01,size=.2 -> 20% of available space
</PRE>
For an in-memory store, the "type" and "size" fields are required, and the
"path" field is forbidden. The "type" field must be set to "mem", and the
"size" field must be set to the true maximum bytes or percentage of available
memory that the store may consume, for example:
<PRE>
--store=type=mem,size=20GiB
--store=type=mem,size=90%
</PRE>
Commas are forbidden in all values, since they are used to separate fields.
Also, if you use equal signs in the file path to a store, you must use the
"path" field label.
(default is 'cockroach-data' in current directory except for mt commands
which use 'cockroach-data-tenant-X' for tenant 'X')
`,
}
StorageEngine = FlagInfo{
Name: "storage-engine",
Description: `
Storage engine to use for all stores on this cockroach node. The only option is pebble. Deprecated;
only present for backward compatibility.
`,
}
Size = FlagInfo{
Name: "size",
Shorthand: "z",
Description: `
The Size to fill Store upto(using a ballast file):
Negative value means denotes amount of space that should be left after filling the disk.
If the Size is left unspecified, it defaults to 1GB.
<PRE>
--size=20GiB
</PRE>
The size can be given in various ways:
<PRE>
--size=10000000000 -> 10000000000 bytes
--size=20GB -> 20000000000 bytes
--size=20GiB -> 21474836480 bytes
--size=0.02TiB -> 21474836480 bytes
--size=20% -> 20% of available space
--size=0.2 -> 20% of available space
--size=.2 -> 20% of available space</PRE>`,
}
Verbose = FlagInfo{
Name: "verbose",
Description: `
Verbose output.`,
}
TempDir = FlagInfo{
Name: "temp-dir",
Description: `
The parent directory path where a temporary subdirectory will be created to be used for temporary files.
This path must exist or the node will not start.
The temporary subdirectory is used primarily as working memory for distributed computations
and CSV importing.
For example, the following will generate an arbitrary, temporary subdirectory
"/mnt/ssd01/temp/cockroach-temp<NUMBER>":
<PRE>
--temp-dir=/mnt/ssd01/temp
</PRE>
If this flag is unspecified, the temporary subdirectory will be located under
the root of the first store.`,
}
ExternalIODir = FlagInfo{
Name: "external-io-dir",
Description: `
The local file path under which remotely-initiated operations that can specify
node-local I/O paths, such as BACKUP, RESTORE or IMPORT, can access files.
Following symlinks _is_ allowed, meaning that other paths can be added by
symlinking to them from within this path.
<PRE>
</PRE>
Note: operations in a distributed cluster can run across many nodes, so reading
or writing to any given node's local file system in a distributed cluster is not
usually useful unless that filesystem is actually backed by something like NFS.
<PRE>
</PRE>
If left empty, defaults to the "extern" subdirectory of the first store
directory.
<PRE>
</PRE>
The value "disabled" will disable all local file I/O.
`,
}
URL = FlagInfo{
Name: "url",
EnvVar: "COCKROACH_URL",
Description: `
Connection URL, of the form:
<PRE>
postgresql://[user[:passwd]@]host[:port]/[db][?parameters...]
</PRE>
For example, postgresql://myuser@localhost:26257/mydb.
<PRE>
</PRE>
If left empty, the discrete connection flags are used: host, port,
user, database, insecure, certs-dir.`,
}
User = FlagInfo{
Name: "user",
Shorthand: "u",
EnvVar: "COCKROACH_USER",