index.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. Node Storage
  2. ============
  3. Sentry provides an abstraction called 'nodestore' which is used for storing key/value blobs.
  4. The default backend simply stores them as gzipped blobs in in the 'nodestore_node' table
  5. of your default database.
  6. Django Backend
  7. --------------
  8. The Django backend stores all data in the 'nodestore_node' table, using a the gzipped json blob-as-text pattern.
  9. The backend provides no options, so it should simply be set to an empty dict.
  10. ::
  11. SENTRY_NODESTORE = 'sentry.nodestore.django.DjangoNodeStorage'
  12. SENTRY_NODESTORE_OPTIONS = {}
  13. Riak Backend
  14. ------------
  15. Riak is the recommended backend for installations which have a large data consumption pattern, and would prefer to
  16. scale out, rather than scale up a single SQL node.
  17. Some notes on your Riak installation:
  18. - You will want to the ``leveldb`` backend as blobs are larger, and compression helps greatly.
  19. - Reads explicitly use ``r=1``.
  20. - We recommend ``n=2`` for replicas, but if the data isn't extremely important, ``n=1`` is fine.
  21. ::
  22. SENTRY_NODESTORE = 'sentry.nodestore.riak.RiakNodeStorage'
  23. SENTRY_NODESTORE_OPTIONS = {
  24. # specify each of your Riak nodes, or the address of your load balancer
  25. 'nodes': [
  26. {'host':'127.0.0.1','http_port':8098},
  27. ],
  28. # (optional) specify an alternative bucket name
  29. # 'bucket': 'nodes',
  30. # (optional) change the default resolver
  31. # 'resolver': riak.resolver.last_written_resolver
  32. }
  33. Cassandra Backend
  34. -----------------
  35. Cassandra is a horizontally scalable datastore in many of the same ways as Riak.
  36. The Sentry Cassandra backend only operates over the native CQL interface, so requires Cassandra 1.2+.
  37. ::
  38. CREATE KEYSPACE sentry WITH replication = {
  39. 'class': 'SimpleStrategy',
  40. 'replication_factor': '2'
  41. };
  42. USE sentry;
  43. CREATE TABLE nodestore (
  44. key text PRIMARY KEY,
  45. flags int,
  46. value blob
  47. ) WITH
  48. compaction={'sstable_size_in_mb': '160', 'class': 'LeveledCompactionStrategy'} AND
  49. compression={'sstable_compression': 'SnappyCompressor'};
  50. ::
  51. SENTRY_NODESTORE = 'sentry.nodestore.cassandra.CassandraNodeStorage'
  52. SENTRY_NODESTORE_OPTIONS = {
  53. 'servers': [
  54. '127.0.0.1:9042',
  55. ],
  56. # (optional) specify an alternative keyspace
  57. # 'keyspace': 'sentry',
  58. # (optional) specify an alternative columnfamily
  59. # 'columnfamily': 'nodestore',
  60. }
  61. Custom Backends
  62. ---------------
  63. If you have a favorite data storage solution, it only has to operate under a few rules for it to work w/ Sentry's blob storage:
  64. - set key to value
  65. - get key
  66. - delete key
  67. For more information on implementating your own backend, take a look at ``sentry.nodestore.base.NodeStorage``.