首页 文章 精选 留言 我的

精选列表

搜索[Bot管理],共10000篇文章
优秀的个人博客,低调大师

centOS 7 的文件目录管理及相关的命令

相对和绝对路径 绝对路径:从/目录开始的文件,无论在哪个目录都可以使用绝对路劲访问 相对路径:相对绝对路径来说,从当前目录开始 查看当前目录路径 [root@linux1~] #/etc/sysconfig/network-scripts/ifcfg-ens33#这个就是路径 [root@linux1~] #ls/root/anaconda-ks.cfg /root/anaconda-ks .cfg #这个是就是绝对路径 cd命令 [root @linux1 ~] #pwd#查看当前目录 /root [root @linux1 ~] #cd/etc/#进入到etc目录下 [root @linux1 etc] #pwd /etc #当前目录是etc [root @linux1 etc] #cd#返回上一次目录 [root @linux1 ~] #pwd /root [root @linux1 ~] #cd/etc/ [root @linux1 etc] #pwd /etc [root @linux1 etc] #cd~#进入到当前用户/目录 [root @linux1 ~] #pwd /root [root @linux1 ~] #cd/etc/ [root @linux1 etc] #cd..#进入到上级目录 [root @linux1 /] #pwd / [root @linux1 /] #cd-#返回上次所在目录 /etc [root @linux1 etc] #cd- / [root @linux1 /] # 创建和删除目录mkdir/rmdir #mkdir创建目录 [root@linux1/] #mkdir-pv/tmp/a/1/2/3#可视化创建目录带有两个参数:p&v分别表示级联创建和可视化创建 mkdir :已创建目录 "/tmp/a" mkdir :已创建目录 "/tmp/a/1" mkdir :已创建目录 "/tmp/a/1/2" mkdir :已创建目录 "/tmp/a/1/2/3" [root@linux1/] #mkdir/tmp/a/2#创建/tmp/a/2目录 [root@linux1/] #cd/tmp/a/ [root@linux1a] #pwd /tmp/a #rmdir只能删除非空目录 [root@linux1a] #rmdir/tmp/a/1/2/3#删除/tmp/a/1/2/3目录 [root@linux12] #cd/tmp/a/1/2/3 - bash : cd : /tmp/a/1/2/3 :没有那个文件或目录 [root@linux12] #touch/tmp/a/1/2/1.txt#创建1.txt文件 [root@linux12] #rmdir/tmp/a/1 rmdir :删除 "/tmp/a/1" 失败:目录非空 rm命令 #rmremove删除文件或者非空目录 [root@linux1~] #ls/tmp/a/1/2 1.txt [root@linux1~] #rm-f/tmp/a/1/2/*#删除1.txt文件*表示通配符,即删除目录下的文件 [root@linux1~] #ls/tmp/a/1/2 [root@linux1~] #rm-rfv/tmp/a/1#强制删除目录参数:r、f、v各表示删除目录强制删除文件,无需提示可视化删除 已删除目录: "/tmp/a/1/2" 已删除目录: "/tmp/a/1"

优秀的个人博客,低调大师

IOS 多于UIImageView 当加载较大的高清闪存管理

当我们是一家人View 多于UIImageView,和UIImageView表明一个更大的HD,可能存在的存储器的警告的问题。假设第一次走进这个view,无记忆出现预警。当重新进入view,在那曾经的记忆不及时释放的假设。这是蓄积的经时,它可以导致内存破坏。 1,UIImage 载入图片的方式。 假设是本地图片,尽量不要使用 [UIImage imageNamed:nil]; 这样的方式,假设使用这样的方式载入。仅仅要程序不退出,它便一直会在内存中。 我们能够使用 : NSString*path = [[NSBundlemainBundle]pathForResource:@'"图片的名字"ofType:@""]; UIImage*image = [UIImageimageWithContentsOfFile:path]; 那两者的优缺点就非常明显了,[UIImage imageNamed:nil]; 仅仅需载入一次,它便在内存中,所以第二次载入速度非常快。而另外一种载入方式因为我们将它释放掉了,会再次载入。 所以选用那种方式,依你情况而定。 2,上面说的另外一种方式。尽管能够释放掉,但我们要告诉人家什么时候释放。也就是说,当前显示页面不是这个view时,我们便将它释放掉: - (void)viewWillDisappear:(BOOL)animated{ [UIImageViewremoveFromSuperview]; UiImageView=nil; } 当然,当我们再次进入这个view时,便要将移除掉的view再次加入进来 - (void)viewDidAppear:(BOOL)animated{ [self addSubView:UIImageView]; } 3,上述两种方式。主要解决内存累加的问题。但假设第一次进入view。图片所有渲染在view上时。内存就崩溃了。 那我们仅仅能在图片上做文章了。我们载入的高清大图假设差点儿相同都是3000*2000,也可能比这个还大,就算我们的程序是iPad App,iPad 4 的分辨率才多少。这些图远远大于设备的分辨率,全然是资源浪费,所以我们通常的一个做法,便是将这种图以小尺寸渲染到view上。 推荐使用: UIImage+Resize.h, UIImage+Resize.m Extends the UIImage class to support resizing (optionally preserving the original aspect ratio), cropping, and generating thumbnails. UIImage+RoundedCorner.h, UIImage+RoundedCorner.m Extends the UIImage class to support adding rounded corners to an image. UIImage+Alpha.h, UIImage+Alpha.m Extends the UIImage class with helper methods for working with alpha layers (transparencies). 经常用法: UIImage*image UIImage*thumbImage = [imagethumbnailImage:140// This should the size of the view in collection view. example: myCell width is 20 and height is 20. transparentBorder:0 cornerRadius:0 interpolationQuality:kCGInterpolationMedium]; //生成缩略图 // this "resizedimage" image is what you want to pass to setImage UIImage* resizedImage = [imageresizedImage:imageview.frame.sizeinterpolationQuality:kCGInterpolationLow]; //生成你想要尺寸的图 造成的问题,要注意缩放的比例,不要导致图片变形,因为尺寸缩小,可能会导致图片模糊,注意缩小的尺寸。 综上可见。每种方法有长处,有缺点。主要根据自己的开发情况,用妥协。 版权声明:本文博客原创文章。博客,未经同意,不得转载。 本文转自mfrbuaa博客园博客,原文链接http://www.cnblogs.com/mfrbuaa/p/4731201.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

开源组件ELK日志系统配置与管理

ELK日志系统介绍 开源实时日志分析ELK平台能够完美的解决我们上述的问题,ELK由ElasticSearch、Logstash和Kiabana三个开源工具组成。官方网站:https://www.elastic.co/products 1、Elasticsearch是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等 2、Logstash是一个完全开源的工具,他可以对你的日志进行收集、过滤,并将其存储供以后使用(如,搜索) 3、Kibana 也是一个开源和免费的工具,它Kibana可以为 Logstash 和 ElasticSearch 提供的日志分析友好的 Web 界面,可以帮助您汇总、分析和搜索重要数据日志 安装环境准备 首先需要下载好相关的软件安装包 官方网站:https://www.elastic.cohttps://artifacts.elastic.co/downloads/logstash/logstash-5.3.1.tar.gzhttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.1.tar.gzhttps://artifacts.elastic.co/downloads/kibana/kibana-5.3.1-linux-x86_64.tar.gz 安装配置JAVA环境 JDK版本:jdk-8u144-linux-x64.tar.gz [root@centos7-1 ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@centos7-1 ~]# uname -r 3.10.0-693.el7.x86_64 [root@centos7-1 ~]# tar zxf jdk-8u144-linux-x64.tar.gz -C /usr/local/ [root@centos7-1 ~]# ln -s /usr/local/jdk1.8.0_144 /usr/local/jdk [root@centos7-1 ~]# cat >>/etc/profile <<EOF export JAVA_HOME=/usr/local/jdk export PATH=$PATH: $JAVA_HOME/bin export CLASSPATH=.CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar EOF [root@centos7-1 ~]# source /etc/profile [root@centos7-1 ~]# java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) 安装Elasticserach 修改系统参数 [root@centos7-1 config]# vim /etc/sysctl.conf #增加下面的配置 vm.max_map_count=655360 [root@centos7-1 config]# sysctl -p vm.max_map_count = 655360 [root@centos7-1 config]# tail -5 /etc/security/limits.conf * soft nofile 65536 * hard nofile 131072 * soft nproc 65536 * hard nproc 131072 # End of file [root@centos7-1 config]# vim /etc/security/limits.d/20-nproc.conf #增加下面的配置 elk soft nproc 65536 创建用户与目录 [root@centos7-1 config]# useradd elk [root@centos7-1 config]# mkdir /elk/data /elk/logs -p [root@centos7-1 config]# chown -R elk.elk /elk/ [root@centos7-1 config]# chown -R elk.elk /usr/local/elasticsearch/ 安装与配置 [root@centos7-1 ~]# tar zxf elasticsearch-5.3.1.tar.gz -C /usr/local/ [root@centos7-1 ~]# ln -s /usr/local/elasticsearch-5.3.1 /usr/local/elasticsearch [root@centos7-1 ~]# cd /usr/local/elasticsearch/config/ 修改配置文件 [root@centos7-1 config]# egrep -v "^#|^$" elasticsearch.yml cluster.name: myelk #集群名 node.name: centos7-1 path.data: /elk/data path.logs: /elk/logs network.host: 0.0.0.0 http.port: 9200 discovery.zen.ping.unicast.hosts: ["host1", "host2"] 启动服务 [root@centos7-1 config]# su - elk [elk@centos7-1 ~]$ who root pts/0 2017-10-13 22:22 (10.0.0.1) [elk@centos7-1 ~]$ cd /usr/local/elasticsearch/bin/ [elk@centos7-1 bin]$ ./elasticsearch& 安装Logstash [root@centos7-1 ~]# tar zxf logstash-5.3.1.tar.gz -C /usr/local/ [root@centos7-1 ~]# /usr/local/logstash-5.3.1/bin/logstash -e 'input { stdin { } } output { stdout {} }' Sending Logstash's logs to /usr/local/logstash-5.3.1/logs which is now configured via log4j2.properties [2017-10-16T01:39:36,983][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"/usr/local/logstash-5.3.1/data/queue"} [2017-10-16T01:39:37,181][INFO ][logstash.agent ] No persistent UUID file found. Generating new UUID {:uuid=>"a2e3b22a-4785-42f6-a073-f7fad4d60a44", :path=>"/usr/local/logstash-5.3.1/data/uuid"} [2017-10-16T01:39:37,623][INFO ][logstash.pipeline] Starting pipeline {"id"=>"main", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125} [2017-10-16T01:39:37,700][INFO ][logstash.pipeline ] Pipeline main started The stdin plugin is now waiting for input: [2017-10-16T01:39:38,042][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600} hello 2017-10-16T05:39:45.692Z centos7-1 hello 创始配置文件 [root@centos7-1 logstash-5.3.1]# cd config/ [root@centos7-1 config]# ll total 20 -rw-rw-r-- 1 root root 1738 Apr 17 12:07 jvm.options -rw-rw-r-- 1 root root 3958 Apr 17 12:07 log4j2.properties -rw-rw-r-- 1 root root 4433 Apr 17 12:07 logstash.yml -rw-rw-r-- 1 root root 1701 Apr 17 12:07 startup.options [root@centos7-1 config]# vim logstash.conf input { stdin { } } output { stdout { codec=> rubydebug } } Logstash 使用 input 和 output 定义收集日志时的输入和输出的相关配置,本例中 input 定义了一个叫 "stdin" 的 input , output 定义一个叫 "stdout" 的 output 。无论我们输入什么字符, Logstash 都会按照某种格式来返回我们输入的字符,其中 output 被定义为 "stdout" 并使用了 codec 参数来指定 logstash 输出格式[root@centos7-1 config]# /usr/local/logstash-5.3.1/bin/logstash -f /usr/local/logstash-5.3.1/config/logstash.conf 安装Kibana [root@centos7-1 ~]# tar zxf kibana-5.3.1-linux-x86_64.tar.gz -C /usr/local/ [root@centos7-1 ~]# cd /usr/local/kibana-5.3.1-linux-x86_64/config/ [root@centos7-1 config]# vim kibana.yml # Kibana is served by a back end server. This setting specifies the port to use. server.port: 5601 # To allow connections from remote users, set this parameter to a non-loopback address. server.host: "10.0.0.5" # The URL of the Elasticsearch instance to use for all your queries. elasticsearch.url: "http://10.0.0.5:9200" # Kibana uses an index in Elasticsearch to store saved searches, visualizations and # dashboards. Kibana creates a new index if the index doesn't already exist. kibana.index: ".kibana" 启动服务[root@centos7-1 config]# /usr/local/kibana-5.3.1-linux-x86_64/bin/kibana & [root@centos7-1 config]# lsof -i :5601 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME node 11535 root 12u IPv4 30703 0t0 TCP centos7-1:esmagent (LISTEN) 登陆WEB界面 测试Kibana与Elasticsearch连接 相关组件安装完成后,就需要测试下几个组件之间能否相互协同工作,也就是能正常收集日志,存储日志并展示日志信息 [root@centos7-1 config]# cd /usr/local/logstash-5.3.1/config/ [root@centos7-1 config]# vim logstash.conf input { stdin { } } output { elasticsearch { action => "index" hosts => "10.0.0.5:9200" index => "logstash-%{+YYYY-MM}" } } [root@centos7-1 config]# /usr/local/logstash-5.3.1/bin/logstash -f /usr/local/logstash-5.3.1/config/logstash.conf 登陆WEB查看是否有日志产生 本文转自 民工哥 51CTO博客,原文链接:http://blog.51cto.com/mingongge/2059799

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册
修改密码
忘记密码