Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create a replicated gluster volume on non-root FS #104

Open
wndhydrnt opened this issue Oct 11, 2017 · 1 comment
Open

Unable to create a replicated gluster volume on non-root FS #104

wndhydrnt opened this issue Oct 11, 2017 · 1 comment

Comments

@wndhydrnt
Copy link

It looks like the gluster volume command needs a echo y.

Cookbook Version: 6.2.0

Configuration of chef-gluster (removed names specific to our system):

default['gluster']['repo'] = 'https://buildlogs.centos.org/centos/7/storage/x86_64/gluster-3.11/'
default['gluster']['server']['brick_mount_path'] = '/var/lib/glusterfs'
default['gluster']['server']['enable'] = true
default['gluster']['version'] = '3.11'
default['gluster']['server']['disks'] = ['/dev/xvdf']
default['gluster']['server']['volumes']['myvolume']['peers'] = ['node01', 'node02']
default['gluster']['server']['volumes']['myvolume']['peer_names'] = ['node01.chef.name', 'node02.chef.name']
default['gluster']['server']['volumes']['myvolume']['size'] = '100%FREE'
default['gluster']['server']['volumes']['myvolume']['volume_type'] = 'replicated'

Log of chef-client (removed names specific to our system):

================================================================================
Error executing action `run` on resource 'execute[gluster volume create]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of gluster volume create myvolume replica 2 node01:/var/lib/glusterfs/myvolume/brick node02:/var/lib/glusterfs/myvolume/brick ----
STDOUT: Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See:  https://gluster.readthedocs.io/en/latest/Administrator%20Guide/Split%20brain%20and%20ways%20to%20deal%20with%20it/.
Do you still want to continue?
 (y/n) gluster cli read error
Invalid input, please enter y/n
STDERR: Usage: volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT> [arbiter <COUNT>]] [disperse [<COUNT>]] [disperse-data <COUNT>] [redundancy <COUNT>] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>?<vg_name>... [force]
---- End output of gluster volume create myvolume replica 2 node01:/var/lib/glusterfs/myvolume/brick node02:/var/lib/glusterfs/myvolume/brick ----
Ran gluster volume create myvolume replica 2 node01:/var/lib/glusterfs/myvolume/brick node02:/var/lib/glusterfs/myvolume/brick returned 1

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/gluster/recipes/server_setup.rb

156:       execute 'gluster volume create' do
157:         command lazy { # rubocop:disable Lint/AmbiguousBlockAssociation
158:           if force
159:             "echo y | #{volume_create_cmd} force"
160:           elsif system("df #{node['gluster']['server']['brick_mount_path']}/#{volume_name}/ --output=target |grep -q '^/$'") && node['gluster']['server']['disks'].empty?
161:             Chef::Log.warn("Directory #{node['gluster']['server']['brick_mount_path']}/ on root filesystem, force creating volume #{volume_name}")
162:             "echo y | #{volume_create_cmd} force"
163:           else
164:             volume_create_cmd
165:           end
166:         }

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/gluster/recipes/server_setup.rb:156:in `block in from_file'

execute("gluster volume create") do
  action [:run]
  retries 0
  retry_delay 2
  default_guard_interpreter :execute
  command #<Chef::DelayedEvaluator:0x000000099adf90@/var/chef/cache/cookbooks/gluster/recipes/server_setup.rb:157>
  backup 5
  returns 0
  declared_type :execute
  cookbook_name "gluster"
  recipe_name "server_setup"
end
@shortdudey123
Copy link
Owner

Long story short, you are trying to do a non-recommended setup. You should have 3 or more hosts for a replica.

You technically can do it with 2 hosts but need to add another elsif in the command block online 157 in server_setup.rb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants