YugaByte DB Community Forum

Keyspace with replication_factor=1?


#1

Hi there,

Trying to create a keyspace with replication factor=1 seems to change the value to 3:
cqlsh> CREATE KEYSPACE myapp WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = false;

Then Describe gives:

cqlsh> describe myapp;
CREATE KEYSPACE myapp WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;

Any ideas?
Thanks!


#2

Hi @hengestone,

Looked into this, you are right that we currently ignore the replication_factor directive. Do you mind opening an issue: https://github.com/YugaByte/yugabyte-db/issues

As a work around, could you please create a cluster with replication factor 1? That would switch the default replication factor to 1. If you are using yb-ctl then you can do the following:
./bin/yb-ctl --replication_factor 1
Similar to this tutorial: https://docs.yugabyte.com/explore/auto-sharding/


#3

Thanks for the quick response :slight_smile:

Sure, I’ll open an issue. If I create the cluster with rf=1 creating a table fails with
Not enough live tablet servers to create table with the requested replication factor 3. 1 tablet servers are alive.


#4

Hey @hengestone! Jumping in real quick as I think there’s a small misunderstanding.

We currently ignore the options on CREATE KEYSPACE and default to internal flags on yb-master for setting up the replication factor (https://docs.yugabyte.com/admin/yb-master/#config-flags, check --replication_factor, which defaults to 3, hence what you’re noticing)

I also am not sure how you’re starting up the cluster though. Is it possible that you’re doing it manually using the respective yb-master/yb-tserver binaries?

The recommended route would be using the bin/yb-ctl python script, which would take care of both setting up the needed number of master/tservers, as well as flowing through custom flags (such as --replication_factor).

As per @karthik’s suggestion, try using ./bin/yb-ctl --replication_factor 1 create , then confirm that it’s up and running using ./bin/yb-ctl status and then you’re good to login and create your keyspaces/tables.

Hope that helps!


#5

You’re right, I previously started the master/tservers manually (via systemd)

Thanks!