2018年2月

在opiz上装docker

最近很喜欢玩docker,所以各种安装写得多一些,参考自己的《玩docker》

uname -a

得到的版本是Linux opiz 4.13.16-sunxi #20 SMP Fri Nov 24 19:50:07 CET 2017 armv7l armv7l armv7l GNU/Linux
运行安装命令

wget -qO- https://get.docker.com/ | sh

可惜报错Could not get lock /var/lib/dpkg/lock,可以用这个命令查看

ps -aux | grep apt

慢慢处理,会好的,安装成功后启动服务,然后需要重起一下

sudo service docker start
sudo usermod -aG docker pi

执行docker info查看版本是18.0.2,然后就可以学习了https://docs.docker.com/get-started/

在docker中安装nginx、php、redis

docker run -ti -h nginx --name nginx_20080 -p 20080:80 ubuntu:14.04
apt-get update
apt-get install nginx
nginx -v 安装的1.4.6版本
cd /usr/share/nginx/html
mv index.html index.html.bak
vi index.html
nginx启动显示hello
apt-get install php5-fpm
cd /etc/nginx
cp sites-available/default default.bak
修改配置文件让php生效
vi sites-available/default
nginx -s reload
service php5-fpm restart
ln -s /usr/share/nginx/html /root/www
vi ip.php

<?php
$ip=$_SERVER["REMOTE_ADDR"];
echo $ip;
echo phpinfo();
?>

可以看到ip说明php配置好啦

找到最新版3.1.6的驱动
https://github.com/phpredis/phpredis/releases
apt-get install wget
wget https://github.com/phpredis/phpredis/archive/3.1.6.tar.gz
tar xzf 3.1.6.tar.gz
cd phpredis-3.1.6
apt-get install php5-dev
phpize
./configure
vi /etc/php5/fpm/php.ini
extension=redis.so 加在php下就可以
service php5-fpm restart

<?php
   $redis = new Redis();
   $redis->connect('192.168.1.220', 26379);
   echo "Connection to server sucessfully";
   echo "Server is running: " . $redis->ping();
?>

继续重入docker attach nginx_20080

参考:http://www.runoob.com/redis/redis-php.html

在docker中安装redis

06.png
首先建立实例
docker run -ti -h redis --name redis_26379 -p 26379:6379 ubuntu:14.04
apt-get update
apt-get install -y python-software-properties
apt-get install software-properties-common
add-apt-repository -y ppa:rwky/redis
用这个办法安装最新版失败了,可能是那个源不在了
apt-get install redis-server安装的是2.8版本,不是最新的
从官方可以装新的
apt-get install wget
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
tar xzf redis-4.0.8.tar.gz
cd redis-4.0.8
apt-get install make
apt-get install gcc
make
会报错jemalloc/jemalloc.h: No such file or directory
改用make MALLOC=libc
如果不是本机启动客户端会警告,用这个启动
src/redis-server --protected-mode no
数据入库比较慢,用mset会快一些,远程打开
redis-cli -h 192.168.1.220 -p 26379

参考资料:
https://redis.io/download
http://mikuq.com/search/docker/
http://blog.csdn.net/chenlix/article/details/46696165

NuGet & Redis for VS2010

工具->扩展管理器,安装完需要重起VS2010
01.jpg

新建一个项目,引用右键,会多出管理NuGet程序包,著名的StackExchange.Redis
02.jpg

真装不上啊,4.0也不行
03.png

尝试NServiceKit.Redis,这个可以装,就学这个吧,需要重新生成项目
04.jpg

简单测试

string redisHost = "127.0.0.1";
RedisClient redis = new RedisClient(redisHost, 6379);
string key = "cat";
byte[] cat=Encoding.UTF8.GetBytes("球猫");
redis.Set(key,cat);
byte[] data = redis.Get(key);
Console.WriteLine(key + " - " + Encoding.UTF8.GetString(data));

大概每秒中可以处理1万次请求,是否可以优化呢?下面是一些命令

keys * 支持模糊查找
flushall 清空所有库
flushdb 清空当前库
dbsize 库中key的数量
select 0 选择0号库(默认)
shutdown 关闭

参考:https://www.cnblogs.com/luking/archive/2012/09/26/2704177.html

没有专业设备不会后期处理也要拍几张月亮

北京18:30,月亮是挺大挺亮的,节目预告:19时48分,食既时刻为20时51分,食甚时刻为21时31分,生光时刻为22时08分,复圆时刻为23时12分
0.jpg

手机肯定是不行了,拍摄器材是Canon IXUS 285 HS,前年双11买的,结果平时用手机,一直闲置,可算用上一次,还基本没啥手动功能,快门最慢1s
11.jpg

19:30的放大图,有些虚了,圆月
1.png

- 阅读剩余部分 -