我想使用 puppet 自动化分配文件中的initial_token
值。cassandra.yaml
谁能告诉我该怎么做。
我不能使用虚拟节点,因为 hadoop 和 solr 节点不支持 vnode。
示例:如果我有一个数组:
['-9223372036854775808', '-3074457345618258603', '3074457345618258602']
我需要将每个值分配给每个节点。
我想使用 puppet 自动化分配文件中的initial_token
值。cassandra.yaml
谁能告诉我该怎么做。
我不能使用虚拟节点,因为 hadoop 和 solr 节点不支持 vnode。
示例:如果我有一个数组:
['-9223372036854775808', '-3074457345618258603', '3074457345618258602']
我需要将每个值分配给每个节点。
You could store that array in a variable in the manifest.
EDIT: if using Cassandra =< 1.2 most Puppet Cassandra modules should have a parameter to set this option. So you could then pass a value from the array into there. For example: https://forge.puppetlabs.com/gini/cassandra
If you're not using a module to set up Cassandra already with this as a parameter, you could create a template of the Cassandra.yaml and just use ERB to input a value from that array into the template.
http://docs.puppetlabs.com/guides/templating.html
EDIT:
Now I am back at a PC I can think a bit more. The instant solution I can think of is to define the tokens in a hash of either node IP address or node hostname => token - '127.0.0.1' => '-9223372036854775808'
. This could be created in the manifest or you can do it via Hiera. If in Hiera, you'll need to extract it into a variable anyway in the manifest.
Then in the template you should be able to reference it with <%= variableName[@::ipaddress_eth0] %>
for example.