$ cat mass_insert.txt
*3
$3
SET
$4
key1
$6
value1
*3
$3
SET
$4
key2
$6
value2
$ cat mass_insert.txt | nc localhost 6379
如果您看到,我有用于在文件中批量插入的 redis 命令mass_insert.text
,我cat
将它发送到 netcat,并且这些命令可以很好地发送到 redis,但不会转储响应。问题是为什么?
一个简单的google.com
HEAD 请求netcat
就可以正常工作,即转储响应 -
$ printf "HEAD / HTTP/1.0\r\n\r\n" | nc google.com 80
HTTP/1.0 302 Found
Location: http://www.google.co.in/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=cac6fac8de9b5d0c:FF=0:TM=1365352115:LM=1365352115:S=CVuSzOK8mrsfFczI; expires=Tue, 07-Apr-2015 16:28:35 GMT; path=/; domain=.google.com
Set-Cookie: NID=67=K5KjAFxuDP5epZKDdvSf4oCe4FRP1AL8LG_9MEdsArn4Oz_UBG69H0KOMUiKLuVN-hH4NIUvHOLgmfh_82P5v6Nh-sGFrGXyCnQz0zD-Sj_QbzxQ6NIK0rahsxjvyTn7; expires=Mon, 07-Oct-2013 16:28:35 GMT; path=/; domain=.google.com; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Date: Sun, 07 Apr 2013 16:28:35 GMT
Server: gws
Content-Length: 221
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN