Documentation ¶
Index ¶
- Constants
- type Admintools
- func (a *Admintools) AddNode(ctx context.Context, opts ...addnode.Option) error
- func (a *Admintools) AddSubcluster(ctx context.Context, opts ...addsc.Option) error
- func (a *Admintools) CreateDB(ctx context.Context, opts ...createdb.Option) (ctrl.Result, error)
- func (a *Admintools) DescribeDB(ctx context.Context, opts ...describedb.Option) (string, ctrl.Result, error)
- func (a *Admintools) FetchNodeState(ctx context.Context, opts ...fetchnodestate.Option) (map[string]string, ctrl.Result, error)
- func (a *Admintools) ReIP(ctx context.Context, opts ...reip.Option) (ctrl.Result, error)
- func (a *Admintools) RemoveNode(ctx context.Context, opts ...removenode.Option) error
- func (a *Admintools) RemoveSubcluster(ctx context.Context, opts ...removesc.Option) error
- func (a *Admintools) RestartNode(ctx context.Context, opts ...restartnode.Option) (ctrl.Result, error)
- func (a *Admintools) ReviveDB(ctx context.Context, opts ...revivedb.Option) (ctrl.Result, error)
- func (a *Admintools) StartDB(ctx context.Context, opts ...startdb.Option) (ctrl.Result, error)
- func (a *Admintools) StopDB(ctx context.Context, opts ...stopdb.Option) error
- type DBCreator
- type DBInitializer
- type DBReviver
- type Dispatcher
- type HTTPSCerts
- type VClusterOps
- func (v *VClusterOps) AddNode(ctx context.Context, opts ...addnode.Option) error
- func (v *VClusterOps) AddSubcluster(_ context.Context, opts ...addsc.Option) error
- func (v *VClusterOps) CreateDB(ctx context.Context, opts ...createdb.Option) (ctrl.Result, error)
- func (v *VClusterOps) DescribeDB(_ context.Context, _ ...describedb.Option) (string, ctrl.Result, error)
- func (v *VClusterOps) FetchNodeState(_ context.Context, opts ...fetchnodestate.Option) (map[string]string, ctrl.Result, error)
- func (v *VClusterOps) ReIP(ctx context.Context, opts ...reip.Option) (ctrl.Result, error)
- func (v *VClusterOps) RemoveNode(_ context.Context, opts ...removenode.Option) error
- func (v *VClusterOps) RemoveSubcluster(_ context.Context, opts ...removesc.Option) error
- func (v *VClusterOps) RestartNode(_ context.Context, opts ...restartnode.Option) (ctrl.Result, error)
- func (v *VClusterOps) ReviveDB(_ context.Context, _ ...revivedb.Option) (ctrl.Result, error)
- func (v *VClusterOps) StartDB(ctx context.Context, opts ...startdb.Option) (ctrl.Result, error)
- func (v *VClusterOps) StopDB(_ context.Context, opts ...stopdb.Option) error
- type VClusterProvider
Constants ¶
const (
// The name of the IP map file that is used by re_ip. re_ip is only ever used if the entire cluster is down.
AdminToolsMapFile = "/opt/vertica/config/ipMap.txt"
)
const (
// Constant for an up node, this is taken from the STATE column in NODES table
StateUp = "UP"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admintools ¶
type Admintools struct { PRunner cmds.PodRunner Log logr.Logger EVWriter events.EVWriter VDB *vapi.VerticaDB DevMode bool // true to include verbose logging for some operations }
Admintools is the legacy style of running admin commands. All commands are sent to a process that runs admintools. The output is then parsed out of the stdout/stderr output that is captured.
func (*Admintools) AddNode ¶
AddNode will add a new vertica node to the cluster. If add node fails due to a license limit, the error will be of type addnode.LicenseLimitError.
func (*Admintools) AddSubcluster ¶
AddSubcluster will create a subcluster in the vertica cluster.
func (*Admintools) CreateDB ¶
CreateDB will create a brand new database using the admintools API (-t create_db).
func (*Admintools) DescribeDB ¶
func (a *Admintools) DescribeDB(ctx context.Context, opts ...describedb.Option) (string, ctrl.Result, error)
DescribeDB will get information about a database from communal storage. For the admintools implementation, this is running the revive with the --display-only option.
func (*Admintools) FetchNodeState ¶
func (a *Admintools) FetchNodeState(ctx context.Context, opts ...fetchnodestate.Option) (map[string]string, ctrl.Result, error)
FetchNodeState will determine if the given set of nodes are considered UP or DOWN in our consensus state. It returns a map of vnode and its node state.
func (*Admintools) ReIP ¶
ReIP will update the catalog on disk with new IPs for all of the nodes given.
func (*Admintools) RemoveNode ¶
func (a *Admintools) RemoveNode(ctx context.Context, opts ...removenode.Option) error
RemoveNode will remove an existng vrtica node from the cluster.
func (*Admintools) RemoveSubcluster ¶
RemoveSubcluster will remove the given subcluster from the vertica cluster.
func (*Admintools) RestartNode ¶
func (a *Admintools) RestartNode(ctx context.Context, opts ...restartnode.Option) (ctrl.Result, error)
RestartNode will restart a subset of nodes. Use this when vertica has not lost cluster quorum. The IP given for each vnode may not match the current IP in the vertica catalogs.
func (*Admintools) ReviveDB ¶
ReviveDB will initialize a database from an existing communal path. Admintools is used to run the revive.
type DBCreator ¶
type DBCreator struct { Admintools *Admintools Parms createdb.Parms }
func (*DBCreator) GenCmd ¶
GenCmd will return the command line options for calling admintools -t create_db.
func (*DBCreator) GetConfigParms ¶
GetConfigParms returns the configuration parameters map.
func (*DBCreator) GetInitiator ¶
func (d *DBCreator) GetInitiator() types.NamespacedName
GetInitiator returns the initiator pod name.
type DBInitializer ¶
type DBReviver ¶
type DBReviver struct { Admintools *Admintools Parms revivedb.Parms }
func (*DBReviver) GenCmd ¶
GenCmd will return the command line options for calling admintools -t revive_db.
func (*DBReviver) GetConfigParms ¶
GetConfigParms returns the configuration parameters map.
func (*DBReviver) GetInitiator ¶
func (d *DBReviver) GetInitiator() types.NamespacedName
GetInitiator returns the initiator pod name.
type Dispatcher ¶
type Dispatcher interface { // CreateDB will create a brand new database. It assumes the communal // storage location is empty. CreateDB(ctx context.Context, opts ...createdb.Option) (ctrl.Result, error) // ReviveDB will initialize a database using a pre-populated communal path. ReviveDB(ctx context.Context, opts ...revivedb.Option) (ctrl.Result, error) // DescribeDB will read state information about the database in communal // storage and return it back to the caller. DescribeDB(ctx context.Context, opts ...describedb.Option) (string, ctrl.Result, error) // FetchNodeState will determine if the given set of nodes are considered UP // or DOWN in our consensous state. It returns a map of vnode to its node state. FetchNodeState(ctx context.Context, opts ...fetchnodestate.Option) (map[string]string, ctrl.Result, error) // ReIP will update the catalog on disk with new IPs for all of the nodes given. ReIP(ctx context.Context, opts ...reip.Option) (ctrl.Result, error) // StopDB will stop all the vertica hosts of a running cluster. StopDB(ctx context.Context, opts ...stopdb.Option) error // AddNode will add a new vertica node to the cluster. If add node fails due to // a license limit, the error will be of type addnode.LicenseLimitError. AddNode(ctx context.Context, opts ...addnode.Option) error // AddSubcluster will create a subcluster in the vertica cluster. AddSubcluster(ctx context.Context, opts ...addsc.Option) error // RemoveNode will remove an existng vertica node from the cluster. RemoveNode(ctx context.Context, opts ...removenode.Option) error // RemoveSubcluster will remove the given subcluster from the vertica cluster. RemoveSubcluster(ctx context.Context, opts ...removesc.Option) error // RestartNode will restart a subset of nodes. Use this when vertica has not // lost cluster quorum. The IP given for each vnode may not match the current IP // in the vertica catalogs. RestartNode(ctx context.Context, opts ...restartnode.Option) (ctrl.Result, error) // StartDB will start a subset of nodes. Use this when vertica has lost // cluster quorum. The IP given for each vnode *must* match the current IP // in the vertica catalog. If they aren't a call to ReIP is necessary. StartDB(ctx context.Context, opts ...startdb.Option) (ctrl.Result, error) }
func MakeAdmintools ¶
func MakeAdmintools(log logr.Logger, vdb *vapi.VerticaDB, prunner cmds.PodRunner, evWriter events.EVWriter, devMode bool) Dispatcher
MakeAdmintools will create a dispatcher that uses admintools to call the admin commands.
func MakeVClusterOps ¶
func MakeVClusterOps(log logr.Logger, vdb *vapi.VerticaDB, cli client.Client, vopsi VClusterProvider, passwd string, evWriter events.EVWriter) Dispatcher
MakeVClusterOps will create a dispatcher that uses the vclusterops library for admin commands.
type HTTPSCerts ¶
type VClusterOps ¶
type VClusterOps struct { Log logr.Logger VDB *vapi.VerticaDB Client client.Client VClusterProvider Password string EVWriter events.EVWriter }
VClusterOps is the new style of running admin commands. It makes use of the vclusterops library to perform all of the admin operations via RESTful interfaces.
func (*VClusterOps) AddSubcluster ¶
AddSubcluster will create a subcluster in the vertica cluster.
func (*VClusterOps) DescribeDB ¶
func (v *VClusterOps) DescribeDB(_ context.Context, _ ...describedb.Option) (string, ctrl.Result, error)
DescribeDB will get information about a database from communal storage.
func (*VClusterOps) FetchNodeState ¶
func (v *VClusterOps) FetchNodeState(_ context.Context, opts ...fetchnodestate.Option) (map[string]string, ctrl.Result, error)
FetchNodeState will determine if the given set of nodes are considered UP or DOWN in our consensous state. It returns a map of vnode to its node state.
func (*VClusterOps) ReIP ¶
ReIP will update the catalog on disk with new IPs for all of the nodes given.
func (*VClusterOps) RemoveNode ¶
func (v *VClusterOps) RemoveNode(_ context.Context, opts ...removenode.Option) error
RemoveNode will remove an existng vertica node from the cluster.
func (*VClusterOps) RemoveSubcluster ¶
RemoveSubcluster will remove the given subcluster from the vertica cluster.
func (*VClusterOps) RestartNode ¶
func (v *VClusterOps) RestartNode(_ context.Context, opts ...restartnode.Option) (ctrl.Result, error)
RestartNode will restart a subset of nodes. Use this when vertica has not lost cluster quorum. The IP given for each vnode may not match the current IP in the vertica catalogs.
func (*VClusterOps) ReviveDB ¶
ReviveDB will initialized a database using an existing communal path. It does this using the vclusterops library.
type VClusterProvider ¶
type VClusterProvider interface { VCreateDatabase(options *vops.VCreateDatabaseOptions) (vops.VCoordinationDatabase, error) VStopDatabase(options *vops.VStopDatabaseOptions) error VStartDatabase(options *vops.VStartDatabaseOptions) error VFetchNodeState(options *vops.VFetchNodeStateOptions) ([]vops.NodeInfo, error) VAddSubcluster(options *vops.VAddSubclusterOptions) error VAddNode(options *vops.VAddNodeOptions) (vops.VCoordinationDatabase, error) VReIP(options *vops.VReIPOptions) error }
VClusterProvider is for mocking test We will have two concrete implementations for the interface
- real implementation in vcluster-ops library
- mock implementation for unit test
Source Files ¶
- add_node_at.go
- add_node_vc.go
- add_sc_at.go
- add_sc_vc.go
- at.go
- create_db_at.go
- create_db_vc.go
- describe_db_at.go
- describe_db_vc.go
- fetch_node_state_at.go
- fetch_node_state_vc.go
- init_db.go
- interface.go
- re_ip_at.go
- re_ip_vc.go
- remove_node_at.go
- remove_node_vc.go
- remove_sc_at.go
- remove_sc_vc.go
- restart_node_at.go
- restart_node_vc.go
- revive_db_at.go
- revive_db_vc.go
- start_db_at.go
- start_db_vc.go
- stop_db_at.go
- stop_db_vc.go
- vc.go
- vc_errors.go