1. Installing memcached
dnf install memcached
Follow the prompts to complete the installation
2. Start memcached
Enter the following command:
service memcached start
Output the following:
Redirecting to /bin/systemctl start memcached.service
Verify that memcached started successfully and enter the following parameters:
ps -aux | grep memcached
If the output:
memcach+ 17974 0.0 0.0 325564 1180 ? Ssl 13:10 0:00 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024
The following content is started successfully.
3. Stop memcamched
Enter the following command:
service memcached stop
See Output as:
Redirecting to /bin/systemctl stop memcached.service
Enter the following command:
ps -aux|grep memcached
To see if the success has stopped
4. Start the memcached Setup boot
Enter the following command:
systemctl enable memcached.service
5. Verify that the boot boot is set successfully
Restart the system, and then enter the following command:
ps -aux | grep memcached
The output is as follows:
memcach+ 855 0.0 0.0 325564 1172 ? Ssl 13:42 0:00 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024
The boot setting is successful.
6. Cancel Boot Boot
Enter the following command to cancel the boot boot:
systemctl disable mysqld.service
7. Start the memcached service with the start parameter
The startup parameters of the memcached are as follows:
-d是启动一个守护进程;-m是分配给Memcache使用的内存数量,单位是MB;-u是运行Memcache的用户;-l是监听的服务器IP地址,可以有多个地址;-p是设置Memcache监听的端口,,最好是1024以上的端口;-c是最大运行的并发连接数,默认是1024;-P是设置保存Memcache的pid文件。
First switch to the directory where memcached executes the files, and the directories installed with DNF are:
/bin, enter the following command to start memcached:
memcached -l xxx.xxx.xxx.x -p 11231 -u root -m 64 -d
The above command means: Use the root user to start memcached, the listening port is 11231, you can set the public IP address.
CentOS 7 uses DNF to install memcached and start, stop, boot, etc. settings