diff options
author | Petr Malik <pmalik@tesora.com> | 2015-03-17 15:40:06 -0400 |
---|---|---|
committer | Petr Malik <pmalik@tesora.com> | 2016-02-10 20:35:13 +0000 |
commit | 01ff9529415ae46a5a8b2d3fa9981cb80e99cd5c (patch) | |
tree | 7175216ba4a50639b696519522ad9aacdd710fff /trove/templates | |
parent | ff235d7a9a4519f9c28aaeed077871c480d8d37a (diff) | |
download | trove-01ff9529415ae46a5a8b2d3fa9981cb80e99cd5c.tar.gz |
Implement user functions for Cassandra datastore
This patch set implements the following functionality for Cassandra
datastore.
create/delete/get user
list users
change password
grant/revoke/list access
update attributes
create/delete database
list databases
Notes on Cassandra users:
In Cassandra only SUPERUSERS can create other users and
grant permissions to database resources.
Trove uses the 'os_admin' superuser to perform its administrative
tasks. It proactively removes the built-in 'cassandra' superuser
on prepare.
The users it creates are all 'normal' (NOSUPERUSER) accounts.
The permissions it can grant are also limited to non-superuser
operations. This is to prevent anybody from creating a new superuser via
the Trove API.
Updatable attributes include username and password.
The configuration template had to be updated to enable authentication
and authorization support (original configuration allowed anonymous
connections). Default implementations used are:
authenticator: org.apache.cassandra.auth.PasswordAuthenticator
authorizer: org.apache.cassandra.auth.CassandraAuthorizer
The superuser password is set to a random Trove password which is then
stored in a Trove-read-only file in '~/.cassandra/cqlshrc' which is
also the default location for client settings.
Notes on Cassandra keyspaces:
Cassandra stores replicas on multiple nodes to ensure reliability and
fault tolerance. All replicas are equally important;
there is no primary or master.
A replication strategy determines the nodes where
replicas are placed.
The total number of replicas across the cluster is referred to as the
replication factor.
The above 'create database' implementation uses 'SimpleStrategy'
with just a single replica on the guest machine.
This is a very simplistic configuration only good for the most basic
applications and demonstration purposes. SimpleStrategy is for a single
data center only.
The following system keyspaces have been included in the default
'ignore_dbs' configuration list and therefore excluded from all database
operations: 'system', 'system_auth', 'system_traces'
Notes on user rename:
Cassandra does not have a native way for renaming users.
The reason why Cassandra itself does not implement rename is apparently just
lack of demand for that feature.
We implement it by creating a new user, transferring permissions and
dropping the old one (which also removes its existing permissions).
I asked about the sanity of this rename approach on the Cassandra mailing
list and IRC channel and there should not be anything inherently wrong
with the proposed procedure.
This method, however, requires the user to always provide a password.
Additional notes:
Trove uses the official open-source Python driver for Cassandra
to connect to the database and execute queries.
The connection is implemented in CassandraConnection. It is now also
used to obtain the current database status as opposed to the original
method of parsing output of the client tool.
The 'common/operating_system' module was extended with two new functions
for reading/writing ini-style and YAML configuration files to/from Python
dicts. Unit tests were added to 'guestagent/test_operating_system'.
The existing Manager unit tests were extended to include the added
functionality.
Also includes some minor improvements to comments and log messages.
Used the existing operating_system interface to update file
ownership.
The system module was removed and its contents moved to the Application
class. This is to reduce the number of files and help facilitate
overriding.
Implements: blueprint cassandra-database-user-functions
Depends-On: I0faa3a4b9c7302064fb2413b572e2fc515efff0d
Change-Id: I7021f6a0e9a3a933f00cfb7a5d987dc6fe2f95a6
Diffstat (limited to 'trove/templates')
-rw-r--r-- | trove/templates/cassandra/config.template | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/trove/templates/cassandra/config.template b/trove/templates/cassandra/config.template index 221009fc..e369ff8e 100644 --- a/trove/templates/cassandra/config.template +++ b/trove/templates/cassandra/config.template @@ -5,8 +5,8 @@ max_hint_window_in_ms: 10800000 hinted_handoff_throttle_in_kb: 1024 max_hints_delivery_threads: 2 batchlog_replay_throttle_in_kb: 1024 -authenticator: AllowAllAuthenticator -authorizer: AllowAllAuthorizer +authenticator: org.apache.cassandra.auth.PasswordAuthenticator +authorizer: org.apache.cassandra.auth.CassandraAuthorizer permissions_validity_in_ms: 2000 partitioner: org.apache.cassandra.dht.Murmur3Partitioner data_file_directories: @@ -38,11 +38,11 @@ trickle_fsync: false trickle_fsync_interval_in_kb: 10240 storage_port: 7000 ssl_storage_port: 7001 -listen_address: localhost +listen_address: 127.0.0.1 start_native_transport: true native_transport_port: 9042 start_rpc: true -rpc_address: localhost +rpc_address: 127.0.0.1 rpc_port: 9160 rpc_keepalive: true rpc_server_type: sync |