In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Prepare environment 1.1, transfer essential software
There are several dependences of zimg you should build and install before using zimg. And the version of cmake should > = 2. 8, libevent should > = 2. 0, libmemcached should > = 1. 0.18.
Yum install openssl-devel cmake libevent-devel libjpeg-devel giflib-devel libpng-devel libwebp-devel ImageMagick-devel libmemcached-devel
Install the required software, but not on libwebp-devel yum
Libwebp-devel, libevent, and libmemcached need to be recompiled because the version on yum is too low
1. Install libevent
Wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
Tarzxvf libevent-2.0.17-stable.tar.gz
Cd libevent-2.0.17-stable
. / configure-- prefix=/usr/local
Make&& make install
2. Install libmemcached
Wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
Tarzxvf libmemcached-1.0.18.tar.gz
Cd libmemcached-1.0.18
. / configure-prefix=/usr/local
Make & & make install
3. Install libwebp-devel
Wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz( this file cannot be downloaded temporarily)
Tarzxvf libwebp-0.4.1.tar.gz
Cd libwebp-0.4.1
. / configure
Make
Sudo make install
, installation
Now you can build zimg itself. If you want to gdbzimg, you can use make debug option.
Git clone https://github.com/buaazp/zimg-b master-- depth=1
Cdzimg
Make
If you want to enable cache to improve performance, or you want to store the images to a distributed storage backend, the softwares below is optional.
Build Optional Storage Backendsmemcached (optional)
Wget http://www.memcached.org/files/memcached-1.4.19.tar.gz
Tarzxvf memcached-1.4.19.tar.gz
Cd memcached-1.4.19
. / configure-- prefix=/usr/local
Make
Make install
Beansdb (optional)
Git clone https://github.com/douban/beansdb
Cdbeansdb
. / configure-- prefix=/usr/local
Make
Benseye (optional)
Git clone git@github.com:douban/beanseye.git
Cdbeanseye
Make
SSDB (optional)
Wget-- no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
Unzip master
Cdssdb-master
Make
Twemproxy (optional)
Git clone git@github.com:twitter/twemproxy.git
Cdtwemproxy
Autoreconf-fvi
. / configure-- enable-debug=log
Make
Src/nutcracker-h
III. Start up and run
Before running zimg, you need to follow the instructions in the "Install documentation". After the zimg installation is successful, you can simply modify the configuration file and start it. All the options of zimg itself are configured in the configuration file, which you can modify according to your needs:
-- zimg server config
-- server config
-- whether to run in the background
Is_daemon = 1
-- bind IP
Ip = '0.0.0.0'
-- Port
Port = 4869
-- number of running threads. Default is the number of server CPU.
-- thread_num=4
Backlog_num = 1024
Max_keepalives = 1
Retry = 3
System = io.popen ('uname-sn'): read (' * l')
Pwd = io.popen ('pwd'): read (' * l')
-- header config
-- the HTTP header returned with
Headers = 'Cache-Control:max-age=7776000'
-- whether to enable etag caching
Etag = 1
-- access config
-- support mask rules like 'allow 10.1.121.138Universe 24'
-- NOTE: remove rule can improve performance
-- IP control permissions of the upload API. Commenting out the permission rules can improve the processing capacity of the server, as shown below.
-- upload_rule = 'allow all'
-- IP control permissions of the download API
-- download_rule = 'allow all'
-- IP control permissions of the management interface
Admin_rule = 'allow 127.0.0.1'
-- cache config
-- whether to enable memcached caching
Cache = 1
-- caching server IP
Mc_ip = '127.0.0.1'
-- Cache server port
Mc_port = 11211
-- log config
-- log_level output specified level of log to logfile
-- [
LOG_FATAL 0 System is unusable
LOG_ALERT 1 Action must be taken immediately
LOG_CRIT 2 Critical conditions
LOG_ERROR 3 Error conditions
LOG_WARNING 4 Warning conditions
LOG_NOTICE 5 Normal, but significant
LOG_INFO 6 Information
LOG_DEBUG 7 DEBUG message
]]
-- output log level
Log_level = 6
-- output log path
Log_name = pwd.. '/ log/zimg.log'
-- htdocconfig
-- default home page html file path
Root_path = pwd.. '/ www/index.html'
-- admin page html file path
Admin_path = pwd.. '/ www/admin.html'
-- image process config
-- disable URL image processing
Disable_args = 0
-- disable lua script image processing
Disable_type = 0
-- lua process script
-- lua script file path
Script_name = pwd.. '/ script/process.lua'
-- format value: 'none' for original or other format names
-the format of the new image is saved by default, and the string 'none'' indicates that it is saved in the original format, or the desired format name.
Format = 'jpeg'
-- quality value: 1100 (default: 75)
-- the quality of the new picture is saved by default
Quality = 75
-- storage config
-- zimg support 3 ways for storage images
-- Storage backend type, 1 is local storage, 2 is memcached protocol backend, such as beansdb,3 is redis protocol backend, such as SSDB
Mode = 1
-- save_new value: 0.don't save any 1.save all 2.only save types in lua script
-- whether the new files are stored. 0 is not stored, 1 is all stored, and 2 is only the new images generated by lua scripts.
Save_new = 1
-- size limit for uploading images. Default is 100MB.
Max_size = 100,1024,1024
-- A list of image types allowed to be uploaded
Allowed_type = {'jpeg',' jpg', 'png',' gif', 'webp'}
-- mode [1]: local disk mode
-- Storage path for local storage
Img_path = pwd.. '/ img'
-- mode [2]: beansdb mode
-- beansdb server IP
Beansdb_ip = '127.0.0.1'
-- beansdb server port
Beansdb_port = 7900
-- mode [3]: ssdb mode
-- SSDB server IP
Ssdb_ip = '127.0.0.1'
-- SSDB server port
Ssdb_port = 8888
IV. Verification of installation structure
Then start zimg:
Cd bin
. / zimgconf/zimg.lua
Use upload
After zimg starts, you can upload and download images. There are two ways to upload images:
The first is uploading through a browser. The default address after launching zimg is a simple image upload page:
Http://127.0.0.1:4869/
It looks something like this:
After a successful upload, the MD5 of the image will be returned in HTML format:
Other commonly used commands
Commands used
Http://zimg.buaa.us/documents/guidebookcn/
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.