Linux mount

3. The upload file synchronization problem is solved.

Since the cluster is configured with a virtual path, all static files are read from the virtual path defined by you. Therefore, when you upload, it is uploaded to a different path, which will result in a successful upload, and other tomcats cannot access it.

There are several schemes to deal with, first, file synchronization, second, disk sharing, third, tomcat virtual path mapping. The first two are handled by the operating system and other software. The third one is explained here.

The configuration methods are as follows:

1. Create an xml file in .%TOMCAT_HOME%\conf\Catalina\localhost and write

<Context path="/web" docBase="D:/myweb" crossContext=" false" debug="0"

reloadable="true"></Context> Recommended method

2. Open the %TOMCAT_HOME%\conf\server.xml

file and add the following code between <host> </host>: <Context path= "/web" docBase="E:\myweb"

debug="0" reloadable="true"/>
or put appBase="" in <host>



NFS installation and configuration under Ubuntu 14.04 is
unforgettable 2014-07-21 6084 Read the
Data NFS
reference: http://www.linuxidc.com/Linux/2013-08/89154.htm

1. Execute the command: sudo apt-get install nfs-kernel -server ;

2. Execute the command: mkdir /home/jacobxu/nfs-jacoxu to create a dedicated folder for the nfs service;

3. After the folder is created, execute the command: sudo vi /etc/exports to configure nfs;

4 , Add in the last line of the article: /home/jacobxu/nfs-jacoxu *(rw,sync,no_root_squash,no_subtree_check)
/home/jacobxu/nfs-jacoxu *(rw,sync,no_root_squash,no_subtree_check) The meaning of this line is:
/home/jacobxu/nfs-jacoxu: The directory shared with the nfs service client, this path must be the same as the path of the file you set earlier!
*: All network segment access is allowed, or specific IP can be used
rw: The client that mounts this directory has read and write permissions to the shared directory
sync: Data is written to memory and hard disk synchronously
no_root_squash: The root user has access to the root directory Full administrative access.
no_subtree_check: Do not check parent directory permissions.

5. After modifying the above configuration file, save and exit.

6. Execute the command: sudo /etc/init.d/rpcbind restart to restart the rpcbind service. nfs is an RPC program. Before using it, you need to map the port and set it through rpcbind.

7. Execute the command: sudo /etc/init.d/nfs-kernel-server restart to restart the nfs service.

8. Mount command:
sudo mount -t nfs 192.168.111.128:/home/jacobxu/nfs-jacoxu /nfs-jacoxu-node001/
to any server to execute the mount command, you can specify the share on the ip server Path, mount to local.

Note: nfs is just a file directory sharing mode that is accessed locally. HDFS is a distributed file system that can load balance data among servers.

9. Automatic mount at boot:
write the above command sudo mount -t nfs 192.168.111.128:/home/jacobxu/nfs-jacoxu /nfs-jacoxu-node001/ to the /etc/rc.local file

Appendix : Common parameters of NFS are as follows :
ro read-only access
rw read-write access sync all data is written to share when requested
async nfs can respond to requests before writing data
secure nfs send over secure TCP/IP port below
1024 insecure nfs send over port above 1024
wdelay if If multiple users want to write to the nfs directory, they are grouped to write (default)
no_wdelay Writes immediately if multiple users want to write to the nfs directory, this setting is not required when using async.
hide Do not share its subdirectories in the nfs shared directory
no_hide Share the subdirectories of the nfs directory
subtree_check If a subdirectory such as /usr/bin is shared, force nfs to check the permissions of the parent directory (default)
no_subtree_check Relative to the above, do not check the parent Directory permissions
all_squash Shared file UID and GID mapping anonymous user anonymous, suitable for public directories.
no_all_squash keep UID and GID of shared files (default)
root_squash All requests of root user are mapped to the same permissions as anonymous user (default)
no_root_squas root user has full administrative access to the root directory
annuid=xxx Specifies the nfs server /etc/passwd file The UID of the anonymous user in
anongid=xxx specifies the GID of the anonymous user in the /etc/passwd file of the nfs server to


manually perform NFS sharing through mount -t nfs 172.29.43.183:/media/sda6/share/hurray /media/bbp, a super block error.
mount: wrong filesystem type, wrong options, 172.29.43.183:/media/sda6/share/hurray has bad superblock,
       missing codepage or helper, or other errors
       (for some filesystems (e.g. nfs, cifs) you might need
       A /sbin/mount.<type> helper)
       in some cases can find useful information in syslog - try
       a command like dmesg | tail to see.

Solution:
Install nfs-common
sudo apt-get install nfs-common
and then re-execute the mount command.


sudo mount -t nfs 192.168.37.32:/usr/ROOT /usr/ROOT
********************************* ****************************************************

_ ************************
1.1 Building an NFS Server

       NFS (Network FileSystem) is a technology developed by SUN and launched in 1984. It is used to share files between different machines and different operating systems through the network. NFS was originally designed to be used between different systems, so its communication protocol design has nothing to do with the host and operating system.

NFS is divided into servers and clients. When using remote files, just use the mount command to mount the file system on the remote NFS server under the local file system. Operating remote files is no different from operating local files. The files or directories shared by the NFS server are recorded in the /etc/exports file.

       In embedded Linux development, NFS is often used, the target system is usually used as an NFS client, and the Linux host is used as an NFS server. On the target system, mount the NFS shared directory of the server to the local through NFS, and you can directly run the files on the server. When debugging system driver modules and applications, NFS is very necessary, and Linux also supports the NFS root file system, which can directly start the system from the remote NFS root, which is also very necessary for the cutting and integration of embedded Linux root file systems. .

Install nfs-kernel-server:

ky@ubuntu:~$ sudo apt-get install nfs-kernel-server

Set up the NFS-Server directory. Modify the /etc/exports file and add the NFS server directory to it. An NFS server can share multiple NFS directories. In the /etc/exports file, the settings for each directory are on an exclusive line. The writing format is as follows:

NFS shared directory path client IP or name (parameter 1, parameter 2,..., Parameter n)

       description:

q The NFS shared directory can be any directory of the host. For convenience, it is best to set the permission to 777.

q Client refers to the IP or host name of the client that can access the shared directory, which can be the specified IP or host name. If using IP, wildcards can be used. If the client whose IP is 192.168.1.x can be accessed, it can be written as 192.168.1.*, if it is set to *, it means that any client can access.

The q access parameter can be one or more, separated by commas. Possible parameters and descriptions are listed in REF _Ref286733518 \h Table 5.108D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0052006500660032003800360037003300330035000003500000310.

Table STYLEREF 1 \s 5. SEQ Table \* ARABIC \s 1 1 NFS setting parameters and descriptions

Parameter

Description

ro

read-only access

rw read-

write access

sync

all data write share when requested

async

nfs can respond to requests before writing data

secure

nfs sends over secure TCP/IP ports below 1024

insecure

nfs sends

wdelay over ports above 1024

If multiple users want to write to the nfs directory, group write (default)

no_wdelay

If multiple users want to write to the nfs directory, Then write immediately. When using async, this setting is not required.

hide

does not share its subdirectories in the nfs shared directory

no_hide

shares the subdirectories of the nfs directory

subtree_check

If a subdirectory like /usr/bin is shared, force nfs to check the permissions of the parent directory (default)

no_subtree_check

does not check the parent directory permissions

all_squash

shared file UID and GID mapping anonymous user anonymous, suitable for public directories

no_all_squash

keep the UID of shared files and GID (default)

root_squash

All requests of the root user are mapped to the same permissions as the anonymous user (default)

no_root_squash

The root user has full administrative access to the root directory

anonuid=xxx specifies the UID anongid

of the anonymous user in the /etc/passwd file of the nfs server

=xxx

specifies the GID of the anonymous user in the /etc/passwd file of the nfs server.



Assume that the NFS shared directory is /home/ky/nfs, allowing all clients to access, the /etc/exports file can be written as:

/home/ky/nfs *( rw,sync,no_subtree_check,no_root_squash)

to start the NFS server. Start portmap (if necessary) and nfs-kernel-server services:

ky@ubuntu:~$ sudo service portmap start

ky@ubuntu:~$ sudo service nfs-kernel-server start

       Authenticate the NFS server locally. Mount the NFS server directory to another directory on the local machine, and you can see the files in the NFS server directory under the mount point directory.

ky@ubuntu:~$ ls /home/ky/nfs/

aaaa

ky@ubuntu:~$ sudo mount -t nfs 127.0.0.1:/home/ky/nfs /mnt

ke@ubuntu:~$ ls /mnt

aaaa

ky@ ubuntu:~$ sudo umount /mnt/

Use the development board to verify that the NFS server is available. Start the development board, enter the system, configure the IP address of the development board, use the mount command to mount the NFS directory of the NFS server:

target# mount -t nfs 192.168.1.3:/home/ky/nfs /mnt -o nolock

target# ls /mnt

kingyee

target# umount /mnt/

       After the mount is successful, you can see the files on the NFS server in the /mnt directory of the development board.

Note, to use the development board and the guest system installed on the virtual machine to mount the NFS, you need to set the virtual network card to Bridged mode, and it is recommended to use a static IP address.

       If you need to add a new NFS shared directory in use, you can directly modify the /etc/exports file. After modifying the file, you can use the exportfs command to read the /etc/exports file without restarting the NFS service, and re-share the output. The exportfs command syntax is as follows:

   exportfs [-aruv]

       Option description:

-a: all mount (or unload) the settings of /etc/exports;

-r: remount the settings of /etc/exports;

-u: unload a certain directory;

-v: when outputting, put The shared directory is displayed.

       If NFS has been started, the /etc/exports file has been modified, and the new settings will take effect by executing the following command:

ky@ubuntu:~$ exportfs -ra

***************** **************************************************** ****************************************************

_ **************************************************** ******
If you choose to install the necessary development tools option when installing Centos7, the system has already installed the necessary software for NFS.
Configuration:
# vi /etc/exports
/home/qws/share 192.168.168.0/24 (rw,sync,all_squash)
Save

Start  NFS
systemctl start nfs.service 
Check if the configuration is good:
showmount -e
 
Export list for localhost.localdomain:
/home/qws/share (everyone) Linux learning, http://linux.it.net.cn, it
can be seen that it has been configured.
Try to , because there is a firewall,
so you must first close the firewall.

After centos7, use sysytemd
systemctl stop iptables.service


and then use it on the development side:
mount -o nolock -t nfs 192.168.168.99:/home/qws/share /mnt/


************ ****************************************************
_ ********************************************
NFS installation configuration:
centos 5 :
yum install nfs-utils portmap
centos 6 :
yum install nfs-utils rpcbind


This section is the configuration process using centos 6:
Device: The "Basic Server" software configuration package was selected when installing two centos6 OS.
First, let both machines install NFS packages, as shown on the server side:
[root@roothomes /home]$ yum install nfs-utils rpcbind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Setting up Install Process
Package rpcbind-0.2.0-8.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.2.3-15.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package            Arch            Version                 Repository     Size
================================================================================
Updating:
nfs-utils          x86_64          1:1.2.3-15.el6          base          308 k

Transaction Summary
================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 308 k
Is this ok [y/N]: y
Downloading Packages:
nfs-utils-1.2.3-15.el6.x86_64.rpm                        | 308 kB     00:10
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
base/gpgkey                                              | 3.3 kB     00:00 ...
Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating : 1:nfs-utils-1.2.3-15.el6.x86_64 1/2
  Cleanup : 1:nfs-utils-1.2.2-7.el6.x86_64 2/2

Updated:
  nfs- utils.x86_64 1:1.2.3-15.el6

Complete!
[root@roothomes /home]$

server side:
###(Create a mounted directory and mount the directory.)
[root@roothomes /etc]$ mkdir /opt/centos6
[root@roothomes /etc]$ cd /opt/centos6/
[root@roothomes /opt/centos6]$ mkdir thisISnfsFile
[root@roothomes /opt/centos6]$ ls
thisISnfsFile
[root@roothomes /etc]$ vi /etc/exports
[root@roothomes /opt/centos6]$ cat /etc /exports

/opt/centos6 192.168.1.0/24(ro,no_root_squash)
### Note: /opt/centos6 indicates that the IP in the range 192.168.1.0-192.168.1.254 shared by nfs can be accessed, and the access permission is self-reading, root User
### (start the corresponding service)
[root@roothomes /opt/centos6]$ chkconfig nfs on
[root@roothomes /opt/centos6]$ /etc/init.d/rpcbind start
[root@roothomes /opt/centos6 ]$ /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@roothomes /opt/centos6]$ service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]


客户端:
[root@roothomes /home]$ yum install nfs-utils rpcbind
安装完毕!
[root@vmBS00 ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules: [ OK ]
###Check if nfs service can be accessed
[root@vmBS00 ~]# showmount -e 192.168.1.75
Export list for 192.168.1.75:
/opt/centos6 192.168.1.0/24
[root@vmBS00 ~]# mkdir /opt/centos6
[root@vmBS00 ~]# mount -t nfs 192.168.1.75:/opt/centos6/ /opt/centos6/
[root@vmBS00 ~]# ls /opt/centos6/
thisISnfsFile
### Configure automatic mount at boot
[root@vmBS00 ~]# vi /etc/fstab
### Add #192.168.1.75:/opt/centos6/ /opt/centos6/ nfs nodev,ro,rsize=32768,wsize=32768 0 0

[root@vmBS00 ~]# init 6
[root@vmBS00 ~]#
login as: root
[email protected]'s password:
Last login: Mon Mar 5 17:29:04 2012 from 192.168.1.23
[root@vmBS00 ~]# ls /opt/centos6/
thisISnfsFile
[root@vmBS00 ~]#







Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327076929&siteId=291194637