quota_unified_dict_unset
Default | no |
---|---|
Value | boolean |
When updating the unified quota dictionary, specifies whether the dict record is first "unset" before setting it again.
Appearance
unified-quota
) Unified quota plugin is a combined count and dict plugin, which uses quota:count
to keep tabs of local quota and dict lookups to maintain external usage. When quota usage is looked up, it will count local quota usage and increment that with the other product(s) in dict.
INFO
Unified Quota requires Cassandra.
quota_unified_dict_unset
Default | no |
---|---|
Value | boolean |
When updating the unified quota dictionary, specifies whether the dict record is first "unset" before setting it again.
quota_unified_product_name
Default | [None] |
---|---|
Value | string |
Product name for unified quota.
The unified quota schema:
CREATE KEYSPACE IF NOT EXISTS quota
WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': '1' }
AND durable_writes = true;
USE quota;
CREATE TABLE quota.quota_usage (
ox_id text,
type text,
count bigint,
usage bigint,
PRIMARY KEY (ox_id, type)
) WITH CLUSTERING ORDER BY (type ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = { 'keys':'ALL', 'rows_per_partition':'NONE' }
AND comment = ''
AND compaction = { 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
AND compression = { 'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor' }
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
Create the unified quota schema in Cassandra:
cqlsh < unified_quota_scheme.cql
In your dovecot.conf
you must enable the quota_unified
plugin and configure the dict
service:
# Add dict-async socket which provides access to cassandra
service dict-async {
unix_listener dict-async {
user = vmail
}
vsz_limit = 0
}
# Add "service dict"
service dict {
unix_listener dict {
mode = 0600
user = vmail
}
vsz_limit = 0
}
# Add the Cassandra mappings
dict_server {
dict cassandra {
driver = sql
sql_driver = cassandra
cassandra {
hosts = 10.2.3.4
keyspace = quota
}
dict_map priv/quota/messages/$product {
sql_table = quota_usage
username_field = ox_id
value_field count {
type = uint
}
key_field type {
pattern = $product
}
}
dict_map priv/quota/storage/$product {
sql_table = quota_usage
username_field = ox_id
value_field usage {
type = uint
}
key_field type {
pattern = $product
}
}
}
}
# Add "quota_unified" to your mail_plugins
mail_plugins {
quota_unified = yes
}
# Add the unified quota plugin (configured to use Cassandra "dict" driver)
quota "User quota" {
driver = unified
quota_unified_dict_unset = no
dict proxy {
name = cassandra
socket_path = dict-async
}
quota_unified_product_name = dovecot_mail
}