Using Keep with Azure Storage » History » Version 2
Tom Clegg, 10/01/2015 08:36 PM
1 | 1 | Tom Clegg | h1. Using Keep with Azure Storage (BETA) |
---|---|---|---|
2 | |||
3 | Starting at #7241 keepstore can use Azure Storage containers as storage devices. Each data block is stored as a "Block Blob". |
||
4 | |||
5 | Features: |
||
6 | * You can configure multiple Azure volumes |
||
7 | * You can mix Azure and POSIX volumes |
||
8 | * It is safe to share Azure volumes between multiple keepstore processes/hosts |
||
9 | * Azure volumes can be marked readonly |
||
10 | |||
11 | Missing features: |
||
12 | * The @-serialize@ flag is not supported |
||
13 | * There is no way to control the way the data is organized (named) in the container. The name of each blob is the hash of the corresponding data, e.g., @73feffa4b7f6bb68e44cf984c85f6e88@. |
||
14 | |||
15 | h2. Setup |
||
16 | |||
17 | Outline: |
||
18 | # Install the azure CLI tool. |
||
19 | # Set credentials. |
||
20 | @azure login@ |
||
21 | # Set cli tool mode. |
||
22 | @azure config mode arm@ |
||
23 | # Create a resource group (unless you're going to use an existing one, of course). |
||
24 | @azure group create examplegroupname eastus@ |
||
25 | # Create a storage account (ditto). The @--type@ argument determines storage replication policy; see "docs":https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/#replication-for-durability-and-high-availability |
||
26 | @azure storage account create --type LRS --location eastus --resource-group examplegroupname exampleaccountname@ |
||
27 | # Get storage account keys: |
||
28 | @azure storage account keys list --resource-group examplegroupname exampleaccountname@ |
||
29 | (This will give you a base64-encoded key looking something like @t3wfMAZ4/YBso7Jr5dtaR7gdrSJmdqzIv1iLofr/2xkZLqLwjj3iwV1YNYbjPUhewXYpp6KxmJUH9L3cfLALtw==@) |
||
30 | # Create a container: |
||
31 | @AZURE_STORAGE_ACCOUNT=exampleaccountname \@ |
||
32 | @AZURE_STORAGE_ACCESS_KEY="t3wfMAZ4/YBso7Jr5dtaR7gdrSJmdqzIv1iLofr/2xkZLqLwjj3iwV1YNYbjPUhewXYpp6KxmJUH9L3cfLALtw==" \@ |
||
33 | @azure storage container create examplecontainername@ |
||
34 | |||
35 | h2. Configuring keepstore |
||
36 | |||
37 | Store the account key in a file with suitable permissions. (A trailing newline will be ignored, but don't put any other characters in there.) |
||
38 | |||
39 | <pre> |
||
40 | cd /etc/sv/keepstore |
||
41 | (umask 077; vi exampleaccountname.key) |
||
42 | </pre> |
||
43 | |||
44 | 2 | Tom Clegg | Update your run script. If you are already running with some local volumes, your run script might have this: |
45 | 1 | Tom Clegg | |
46 | <pre> |
||
47 | keepstore \ |
||
48 | -volume /data/disk0 -volume /data/disk1 |
||
49 | </pre> |
||
50 | |||
51 | If you want to change your local volumes to be readonly, and use the azure container to write new data, you'd change it to this: |
||
52 | |||
53 | <pre> |
||
54 | keepstore \ |
||
55 | -readonly \ |
||
56 | -volume /data/disk0 -volume /data/disk1 \ |
||
57 | -readonly=false \ |
||
58 | 2 | Tom Clegg | -azure-storage-account-key-file ./exampleaccountname.key \ |
59 | 1 | Tom Clegg | -azure-storage-account-name exampleaccountname \ |
60 | -azure-storage-container-volume examplecontainername |
||
61 | </pre> |
||
62 | 2 | Tom Clegg | |
63 | If you have multiple containers and some of them are in different accounts, you might have something like this: |
||
64 | |||
65 | <pre> |
||
66 | keepstore \ |
||
67 | -readonly \ |
||
68 | -volume /data/disk0 -volume /data/disk1 \ |
||
69 | -readonly=false \ |
||
70 | -azure-storage-account-key-file ./firstaccount.key \ |
||
71 | -azure-storage-account-name firstaccount \ |
||
72 | -azure-storage-container-volume containerA \ |
||
73 | -azure-storage-container-volume containerB \ |
||
74 | -azure-storage-container-volume containerC \ |
||
75 | -azure-storage-account-key-file ./secondaccount.key \ |
||
76 | -azure-storage-account-name secondaccount \ |
||
77 | -azure-storage-container-volume containerX \ |
||
78 | -azure-storage-container-volume containerY \ |
||
79 | -azure-storage-container-volume containerZ |
||
80 | </pre> |
||
81 | |||
82 | When invoked this way, keepstore uses the "firstaccount" credentials to connect to containerA/B/C and use the "secondaccount' credentials to connect to containerX/Y/Z. |