# Distribute Nextcloud across multiple servers fails on NFS

**URL:** <https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558>\
**Category:** ℹ️ Support\
**Tags:** nc14\
**Created:** [October 7, 2018, 12:58pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558 "2018-10-07T12:58:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 7, 2018, 12:58pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/1 "2018-10-07T12:58:25Z")

</div>

Nextcloud version: 14.0.1  
Operating system and version: Ubuntu 16.04, Raspbian 9  
Apache or nginx version: Lighttpd lighttpd/1.4.35 (Ubuntu) and lighttpd/1.4.45 (Raspbian)  
PHP version: 7.0.30-0+deb9u1 (Raspbian) and 7.0.32-0ubuntu0.16.04.1 (Ubuntu)

The issue you are facing: When trying to run the same Nextcloud instance from different servers mounting via NFS the one which mount the `nextcloud` folder don’t work and report something like

```auto
Data folder isn't valid
Ensure that the ".ocdata" is present in the root of your data folder.

```

Is this the first time you’ve seen this error? _(Y/N)_: Y

Steps to replicate it:

1. Install an instance on a server (srv1)
2. Share it via NFS
3. Mount it on another server (srvn)
4. Try to access from srvn
5. Error is reported

NFS export on srv1:

```auto
/var/www/html/nextcloud 10.2.14.0/24(rw,no_subtree_check,sync,nohide)

```

Mount on srvn (fstab):

```auto
srv1:/var/www/html/nextcloud /mnt/nextcloud nfs4 _netdev,bg,nofail,rw,relatime,fsc,rsize=65536,wsize=65536 0 0

```

---

<div class="post-metadata">

**Author:** ![budy](https://help.nextcloud.com/user_avatar/help.nextcloud.com/budy/32/697_2.png) [@budy](https://help.nextcloud.com/u/budy)\
**Post date:** [October 7, 2018, 7:04pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/2 "2018-10-07T19:04:35Z")

</div>

You don’t try to access the same data folder from different servers at the same time, do you?

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 7, 2018, 7:55pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/3 "2018-10-07T19:55:58Z")

</div>

Yes, I do… why can’t I do it? However, is there a way to load balance Nextcloud without replicating the data folder?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![budy](https://help.nextcloud.com/user_avatar/help.nextcloud.com/budy/32/697_2.png) [@budy](https://help.nextcloud.com/u/budy)\
**Post date:** [October 7, 2018, 8:59pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/4 "2018-10-07T20:59:11Z")

</div>

What do you call replication here? You are accessing the same data from different NFS servers, where there’s no locking between them. Also, do you run several distinct databases, one for each NC instance?

Have you searched this forum for load balancing? There is at least one thread, which deals with this in quite detail.

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 7, 2018, 9:15pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/5 "2018-10-07T21:15:34Z")

</div>

Maybe I haven’t been clear… My goal is to use multiple machines to serve a single nextcloud instance. The `nextcloud` folder would be the same (or at least the `data` one), the same for the DB. Regarding the ‘load balancing’ query on the forum I’ve found only a topic in German, which I don’t know. Maybe I need to boost my searching skills, idk.

---

<div class="post-metadata">

**Author:** ![Starfish](https://help.nextcloud.com/letter_avatar/starfish/32/5_5575768a8748004e209b776fc1b2916d.png) [@Starfish](https://help.nextcloud.com/u/Starfish)\
**Post date:** [October 8, 2018, 5:38am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/6 "2018-10-08T05:38:20Z")

</div>

We use NC distributed environment. You have 1 DB, 1 NFS serving 2 APP servers, and the front-end is HAProxy. This can easily be achieved. Is this what you are looking for? You will have a mount point directly on your linux machine containing the mount for the shared NFS volume.

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 8, 2018, 7:10am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/7 "2018-10-08T07:10:28Z")

</div>

Yes, this is exactly what I’m trying to achieve. However, I don’t know why, on the slave servers the invalid data folder is shown.

Thanks in advance,

_Eugenio Tampieri_

---

<div class="post-metadata">

**Author:** ![Starfish](https://help.nextcloud.com/letter_avatar/starfish/32/5_5575768a8748004e209b776fc1b2916d.png) [@Starfish](https://help.nextcloud.com/u/Starfish)\
**Post date:** [October 8, 2018, 7:15am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/8 "2018-10-08T07:15:04Z")

</div>

Could you paste both the server’s config.php files? Just remove sensitive data where needed.

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 8, 2018, 8:00am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/9 "2018-10-08T08:00:01Z")

</div>

They all use the same config.php

```auto
<?php
$CONFIG = array (
  'instanceid' => 'ocws1j898vjr',
  'passwordsalt' => '*',
  'secret' => '*',
  'trusted_domains' => 
  array (
    0 => '*',
    1 => '*',
  ),
  'datadirectory' => '/var/www/html/*/data',
  'dbtype' => 'mysql',
  'version' => '14.0.1.1',
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
  'user_backend_sql_raw' => 
  array (
    'db_type' => 'mariadb',
    'db_port' => '3306',
    'db_name' => '*',
    'db_user' => '*',
    'db_password' => '*',
    'queries' => 
    array (
      'get_password_hash_for_user' => '*',
      'user_exists' => '*',
      'get_users' => '*',
      'get_display_name' => '*',
      'count_users' => '*',
    ),
  ),
  'dbname' => '*',
  'dbhost' => '10.2.14.2',
  'dbuser' => '*',
  'dbpassword' => '*',
  'overwrite.cli.url' => '*',
  'updater.release.channel' => 'stable',
  'theme' => '',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'ssl',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '10.2.14.5',
    'port' => 6379,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'mail_from_address' => '*',
  'mail_domain' => '*',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '*',
  'mail_smtpport' => '465',
  'mail_smtpname' => '*',
  'mail_smtppassword' => '*',
);

```

I think I have found the problem: the mount point is not the same directory… as soon as I get home I’ll check

---

<div class="post-metadata">

**Author:** ![Starfish](https://help.nextcloud.com/letter_avatar/starfish/32/5_5575768a8748004e209b776fc1b2916d.png) [@Starfish](https://help.nextcloud.com/u/Starfish)\
**Post date:** [October 8, 2018, 8:03am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/10 "2018-10-08T08:03:04Z")

</div>

Cool. Report back or just mark the issue as solved for future users.

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 8, 2018, 2:36pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/11 "2018-10-08T14:36:17Z")

</div>

Just to know: which algorithm do you use with Haproxy?

---

<div class="post-metadata">

**Author:** ![Starfish](https://help.nextcloud.com/letter_avatar/starfish/32/5_5575768a8748004e209b776fc1b2916d.png) [@Starfish](https://help.nextcloud.com/u/Starfish)\
**Post date:** [October 9, 2018, 4:23am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/12 "2018-10-09T04:23:21Z")

</div>

Leastconn method. And we do ssl hand-off there as well.

---

<div class="post-metadata">

**Author:** ![eutampieri](https://help.nextcloud.com/letter_avatar/eutampieri/32/5_5575768a8748004e209b776fc1b2916d.png) [@eutampieri](https://help.nextcloud.com/u/eutampieri)\
**Post date:** [October 9, 2018, 5:25am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/13 "2018-10-09T05:25:04Z")

</div>

Thanks. I was asking because I had problems with csrf

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 7:57am UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/14 "2024-12-04T07:57:37Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 3:23pm UTC](https://help.nextcloud.com/t/distribute-nextcloud-across-multiple-servers-fails-on-nfs/38558/15 "2024-12-09T15:23:52Z")

</div>


