cassandra

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2019 License: MIT Imports: 11 Imported by: 0

README

Using the cassandra schema tool

This package contains the tooling for cadence cassandra operations.

For localhost development

make install-schema

For production

Create the binaries

  • Run make bins
  • You should see an executable cadence-cassandra-tool

Do one time database creation and schema setup for a new cluster

This uses Cassandra's SimpleStratagey for replication. For production, we recommend using a replication factor of 3 with NetworkTopologyStrategy.

cadence-cassandra-tool --ep $CASSANDRA_SEEDS create -k $KEYSPACE --rf $RF

See https://www.ecyrd.com/cassandracalculator for an easy way to determine how many nodes and what replication factor you will want to use. Note that Cadence by default uses Quorum for read and write consistency.

./cadence-cassandra-tool -ep 127.0.0.1 -k cadence setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -- upgrades your schema to the latest version

./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0 for visibility
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -- upgrades your schema to the latest version for visibility

Update schema as part of a release

You can only upgrade to a new version after the initial setup done above.

./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -v x.x    -- actually executes the upgrade to version x.x

./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -v x.x    -- actually executes the upgrade to version x.x

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCassandraCluster added in v0.5.0

func NewCassandraCluster(hostsCsv string, port int, user, password, keyspace string, timeoutSeconds int) (*gocql.ClusterConfig, error)

NewCassandraCluster return gocql clusterConfig

func RunTool

func RunTool(args []string) error

RunTool runs the cadence-cassandra-tool command line tool

func SetupSchema

func SetupSchema(config *SetupSchemaConfig) error

SetupSchema setups the cassandra schema

func VerifyCompatibleVersion added in v0.3.6

func VerifyCompatibleVersion(cfg config.Persistence, rootPath string) error

VerifyCompatibleVersion ensures that the installed version of cadence and visibility keyspaces is greater than or equal to the expected version. In most cases, the versions should match. However if after a schema upgrade there is a code rollback, the code version (expected version) would fall lower than the actual version in cassandra.

Types

type CQLClientConfig added in v0.5.7

type CQLClientConfig struct {
	Hosts    string
	Port     int
	User     string
	Password string
	Keyspace string
	Timeout  int
	// contains filtered or unexported fields
}

CQLClientConfig contains the configuration for cql client

type SetupSchemaConfig

type SetupSchemaConfig struct {
	CQLClientConfig
	schema.SetupConfig
}

SetupSchemaConfig contains the configuration params needed to setup schema tables

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL