Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14 from uber/config
Browse files Browse the repository at this point in the history
Cosmetic changes to readme, config and some files
  • Loading branch information
thuningxu committed Jan 17, 2017
2 parents 4854371 + d6a419a commit c6284ea
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 35 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This repo contains the source code of Cherami server, cross-zone replicator serv

Getting started
---------------

To get cherami-server:

```
Expand All @@ -15,29 +14,37 @@ git clone git@github.com:uber/cherami-server.git $GOPATH/src/github.com/uber/che

Build
-----
We use [`glide`](https://glide.sh) to manage Go dependencies. Additionally, we need a Cassandra running locally in order to run the integration tests. Please make sure `glide` and `cqlsh` are in your PATH, and `cqlsh` can connect to the local Cassandra server.
We use [`glide`](https://glide.sh) to manage Go dependencies. Please make sure `glide` is in your PATH before you attempt to build.

* Build the `cherami-server` and other binaries:
* Build the `cherami-server` and other binaries (will not run test):
```
make bins
```

Local Test
----------
We need a Cassandra running locally in order to run the integration tests. Please make sure `cqlsh` is in `/usr/local/bin`, and it can connect to the local Cassandra server.
```
make test
```

Run Cherami locally
-------------------

* Setup the cherami keyspace for metadata:
```
./scripts/cherami-setup-schema
```

* The service can be started as follows:
```
CHERAMI_ENVIRONMENT=laptop CHERAMI_CONFIG_DIR=`pwd`/config CHERAMI_STORE=/tmp/store ./cherami-server start all
CHERAMI_ENVIRONMENT=local ./cherami-server start all
```

Note: `cherami-server` is configured via `config/base.yaml` with some parameters overriden by `config/local.yaml`.

One can use the CLI to verify if Cherami is running properly:
```
./cherami-cli --hostport=<localIP>:4922 create destination /test/cherami
./cherami-cli --env=prod --hostport=<localIP>:4922 create destination /test/cherami
```

Deploy Cherami as a cluster
Expand Down
21 changes: 0 additions & 21 deletions clients/metadata/schema/metadata_keyspace_test.cql

This file was deleted.

2 changes: 1 addition & 1 deletion clients/metadata/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (s *TestCluster) SetupTestCluster() {
ip := `127.0.0.1`
s.createCluster(ip, gocql.Consistency(1), generateRandomKeyspace(10))
s.createKeyspace(1)
s.loadSchema("schema/metadata_test.cql")
s.loadSchema("schema/metadata.cql")

var err error
s.client, err = NewCassandraMetadataService(&configure.MetadataConfig{
Expand Down
1 change: 0 additions & 1 deletion common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ var ringpopBootstrapFile string
const hyperbahnPort int16 = 21300
const rpAppNamePrefix string = "cherami"
const maxRpJoinTimeout = 30 * time.Second
const defaultNumReplicas = 3
const maxRateExtrapolationTime = 120.0

// MaxDuration is maximum time duration
Expand Down
16 changes: 13 additions & 3 deletions config/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# DefaultServiceConfig stores the default service config for each service
DefaultServiceConfig:
HostUUID: ""
HyperbahnBootstrapFile: ""
RingHosts: ""
EnableLimits: true # by default we have limits enabled
ListenAddress: ""
EnableLimits: true

# ServiceConfig overrides default config with service-specific config such as ports
ServiceConfig:
cherami-inputhost:
Port: 4240
Expand Down Expand Up @@ -72,21 +73,30 @@ ServiceConfig:
logLevel: warn
disableLogging: true

# MetadataConfig specifies location of the Cassandra and ketspace
MetadataConfig:
CassandraHosts: ""
Keyspace: "cherami"
Consistency: "one"
ClusterName: "base"

# ReplicatorConfig specifies
ReplicatorConfig:
DefaultAuthoritativeZone: "zone1"
ReplicatorHosts:
zone1: 192.168.0.1
zone2: 192.168.0.2

# Logging configuration
logging:
level: error
stdout: false

# DefaultDestinationConfig right now configures how many replicas you want
DefaultDestinationConfig:
Replicas: 3

# StorageConfig specfies location of the message storage, and the UUID of the storage host. The UUID should be different in each host.
# StorageConfig:
# BaseDir: ""
# HostUUID: ""
12 changes: 12 additions & 0 deletions config/laptop.yaml → config/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,17 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

DefaultDestinationConfig:
Replicas: 1

MetadataConfig:
CassandraHosts: "127.0.0.1"

StorageConfig:
BaseDir: /tmp/cherami-store
HostUUID: "11111111-1111-1111-1111-111111111111"

logging:
level: debug
stdout: true
4 changes: 2 additions & 2 deletions scripts/cherami-setup-schema
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ keyspace="cherami"
CHERAMI_CQLSH_DIR="/usr/local/bin"
CHERAMI_SCHEMA_DIR="clients/metadata/schema"

$CHERAMI_CQLSH_DIR/cqlsh -f $CHERAMI_SCHEMA_DIR/metadata_keyspace_test.cql
$CHERAMI_CQLSH_DIR/cqlsh -k $keyspace -f $CHERAMI_SCHEMA_DIR/metadata_test.cql
$CHERAMI_CQLSH_DIR/cqlsh -f $CHERAMI_SCHEMA_DIR/metadata_keyspace.cql
$CHERAMI_CQLSH_DIR/cqlsh -k $keyspace -f $CHERAMI_SCHEMA_DIR/metadata.cql
2 changes: 1 addition & 1 deletion test/integration/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (tb *testBase) setupSuiteImpl(t *testing.T) {
err = metadata.CreateKeyspace(tb.mClient.GetSession(), tb.keyspace, 1, true)
tb.NoError(err)

err = metadata.LoadSchema("/usr/local/bin/cqlsh", "../../clients/metadata/schema/metadata_test.cql", tb.keyspace)
err = metadata.LoadSchema("/usr/local/bin/cqlsh", "../../clients/metadata/schema/metadata.cql", tb.keyspace)
tb.NoError(err)

// Adjust the controller and storehost scan intervals
Expand Down

0 comments on commit c6284ea

Please sign in to comment.