Memcache文件系统memcachefs部署和使用
Memcache 文件系统memcachefs 部署和使用 介绍 memcachefs是基于FUSE的memcached文件系统,将memcache服务挂载到本地。允许查看缓存中的数据,就好像是磁盘上的文件。memcache的操作都将转换成针对普通文件般的操作。 项目地址:http://memcachefs.sourcefor
Memcache文件系统memcachefs部署和使用
介绍
memcachefs是基于FUSE的memcached文件系统,将memcache服务挂载到本地。允许查看缓存中的数据,就好像是磁盘上的文件。memcache的操作都将转换成针对普通文件般的操作。
项目地址:http://memcachefs.sourceforge.net/
使用场景
基于本地磁盘缓存文件都可以用memcachefs来实现,效率上比磁盘更强大。。比如session文件等等。 如果先前的session信息就存在本地磁盘上,可以直接将memcache挂载到当前session目录上,无需更改程序,完美解决。
安装
1.安装依赖(使用root安装)
依赖
FUSE 2.5 or later
libmemcache 1.4 or later
a)安装fuse-2.9.3.tar.gz
cd /tmp wget http://hivelocity.dl.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz tar zxvf fuse-2.9.3.tar.gz cd fuse-2.9.3 ./configure make make install
b)挂载fuse内核模块
modprobe fuse lsmod | grep "fuse"
c)安装libmemcache-1.4.0.rc2.tar.bz2
cd /tmp wget http://people.freebsd.org/~seanc/libmemcache/libmemcache-1.4.0.rc2.tar.bz2 tar xvf libmemcache-1.4.0.rc2.tar.bz2 cd libmemcache-1.4.0.rc2 ./configure make
编译出错,输出如下:
memcache.c: At top level: ../include/memcache/buffer.h:73: warning: inline function 'mcm_buf_remain_off' declared but never defined ../include/memcache/buffer.h:72: warning: inline function 'mcm_buf_remain' declared but never defined ../include/memcache/buffer.h:66: warning: inline function 'mcm_buf_len' declared but never defined ../include/memcache/buffer.h:73: warning: inline function 'mcm_buf_remain_off' declared but never defined ../include/memcache/buffer.h:72: warning: inline function 'mcm_buf_remain' declared but never defined ../include/memcache/buffer.h:66: warning: inline function 'mcm_buf_len' declared but never defined
解决方法,参考:
http://pietercvdmlinux.blogspot.com/2012_07_01_archive.html
wget 'http://svnweb.freebsd.org/ports/head/databases/libmemcache/files/patch-fix-inline?revision=248965&view=co' -O libcache.patch patch -p0 < libcache.patch
再次
make make install
2.下载安装memcachefs
mkdir /usr/local/memcachefs cd /tmp wget http://jaist.dl.sourceforge.net/project/memcachefs/memcachefs/0.5/memcachefs-0.5.tar.gz tar -zxvf memcachefs-0.5.tar.gz cd memcachefs-0.5 ./configure --prefix=/usr/local/memcachefs make make install cd /usr/local/memcachefs
3.挂载memcached
mkdir /usr/local/cache ./bin/memcachefs 192.168.11.52:11211 /usr/local/cache #将远程的memcache挂载到本地
报错如下:
“./bin/memcachefs: error while loading shared libraries: libmemcache.so.0: cannot open shared object file: No such file or directory”
解决方法:
将/usr/local/lib添加到/etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf /sbin/ldconfig
查看挂载情况:
mount -l
memcachefs on /usr/local/cache type fuse.memcachefs (rw,nosuid,nodev)
使用
1.基本操作
cd /usr/local echo "helloworld" > cache/test_key #设置一个cache数据,文件名是键,文件内容是值。等同于set key value操作。 cat cache/test_key #获取cache数据。等同于get key操作。 ll cache/ #列出所有键。注意第五列不是指大小,而是表示字符长度。第六七列时间属性。 rm cache/test_key #删除cache数据,等同于delete key操作。 mv cache/username cache/username.bak #重命名
2.卸载
# mount #查看挂载 # umount /usr/local/cache #卸载 # fusermount -u /usr/local/cache #卸载
3.使用telnet客户端测试
set a 0 10 3 #10s过期。10s过后,cache目录下的a文件将被删除。
get username.bak #telnet方法获取memcachfs设置的cache数据
cat cache/a #通过memcachefs获取键a数据
[root@test01 local]# telnet 192.168.11.52 11211 Trying 192.168.11.52... Connected to 192.168.11.52. Escape character is '^]'. set a 0 10 3 aaa STORED get username.bak VALUE username.bak 0 6 ryanxu END quit Connection closed by foreign host. [root@test01 local]# cat cache/a aaa

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

The best version of the Apple 16 system is iOS16.1.4. The best version of the iOS16 system may vary from person to person. The additions and improvements in daily use experience have also been praised by many users. Which version of the Apple 16 system is the best? Answer: iOS16.1.4 The best version of the iOS 16 system may vary from person to person. According to public information, iOS16, launched in 2022, is considered a very stable and performant version, and users are quite satisfied with its overall experience. In addition, the addition of new features and improvements in daily use experience in iOS16 have also been well received by many users. Especially in terms of updated battery life, signal performance and heating control, user feedback has been relatively positive. However, considering iPhone14

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

Linux and Windows are two common operating systems, representing the open source Linux system and the commercial Windows system respectively. In both operating systems, there is a command line interface for users to interact with the operating system. In Linux systems, users use the Shell command line, while in Windows systems, users use the cmd command line. The Shell command line in Linux system is a very powerful tool that can complete almost all system management tasks.
