Shell Operation Memcache

Source: Internet
Author: User

[email protected] mc]# cat mc.sh
#!/bin/bash

function Random {
mc0= "192.168.8.62 7510"
#MC1 = "192.168.30.22 7510"
Case "$ (expr $ (date +%s%n) \% 2)" in
0)
Mc= "$MC 0"
;;
1)
mc= "$MC 1"
;;
Esac
}
> Set-result.txt
> Get-result.txt
> Delete-result.txt
For ((i=0;i<500;i++))
Do
a=12345
Random
printf "Set kx$i 0 0 5\r\n${a}\r\n" | NC $MC>>set-result.txt
Done

For ((k=0;k<500;k++))
Do
Random
printf "Get kx$k\r\n" | NC $MC| Sed-n ' 2p ' |sed "s/.*/$k &/" >> get-result.txt
Done

For ((j=0;j<500;j++))
Do
Random
printf "Delete kx$j\r\n" | NC $MC>> Delete-result.txt
Done

echo "Setet number:"
grep stored-c Set-result.txt
echo "Get number:"
grep 12345-c Get-result.txt
echo "Delete number:"
grep deleted-c Delete-result.txt

Exit
####
> Get-result.txt
For ((k=1;k<5;k++))
Do
printf "Get kx$k\r\n" | NC 192.168.1.61 11211 | Sed-n ' 2p ' |sed "s/.*/$k &/" >> get-result.txt
Done
echo "Delete then get number:"
grep 12345-c Get-result.txt

Shell Operation Memcache

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.