监视指定主机和端口的数据包
tcpdump tcp port 23 and host 210.27.48.1
防火墙
hostname
iptables -t filter -I INPUT -p tcp --dport 27107 -m state --state NEW -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 13710 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 13710 -j ACCEPT
service iptables save
vim /etc/puppet/puppet.conf
service puppet restart
iptables -L
more /etc/sysconfig/iptables
vim /etc/sysconfig/iptables
service iptables reload
2表示每个两秒采集一次服务器状态,1表示只采集一次。
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 779304 67972 706748 0 0 135 45 538 1117 10 3 86 2 0
r 表示运行队列(就是说多少个进程真的分配到CPU),我测试的服务器目前CPU比较空闲,没什么程序在跑,当这个值超过了CPU数目,就会出现CPU瓶颈了。这个也和top的负载有关系,一般负载超过了3就比较高,超过了5就高,超过了10就不正常了,服务器的状态很危险。top的负载类似每秒的运行队列。如果运行队列过大,表示你的CPU很繁忙,一般会造成CPU使用率很高。
b 表示阻塞的进程,这个不多说,进程阻塞,大家懂的。
swpd 虚拟内存已使用的大小,如果大于0,表示你的机器物理内存不足了,如果不是程序内存泄露的原因,那么你该升级内存了或者把耗内存的任务迁移到其他机器。
free 空闲的物理内存的大小,我的机器内存总共8G,剩余3415M。
buff Linux/Unix系统是用来存储,目录里面有什么内容,权限等的缓存,我本机大概占用300多M
cache cache直接用来记忆我们打开的文件,给文件做缓冲,我本机大概占用300多M(这里是Linux/Unix的聪明之处,把空闲的物理内存的一部分拿来做文件和目录的缓存,是为了提高 程序执行的性能,当程序使用内存时,buffer/cached会很快地被使用。)
si 每秒从磁盘读入虚拟内存的大小,如果这个值大于0,表示物理内存不够用或者内存泄露了,要查找耗内存进程解决掉。我的机器内存充裕,一切正常。
so 每秒虚拟内存写入磁盘的大小,如果这个值大于0,同上。
bi 块设备每秒接收的块数量,这里的块设备是指系统上所有的磁盘和其他块设备,默认块大小是1024byte,我本机上没什么IO操作,所以一直是0,但是我曾在处理拷贝大量数据(2-3T)的机器上看过可以达到140000/s,磁盘写入速度差不多140M每秒
bo 块设备每秒发送的块数量,例如我们读取文件,bo就要大于0。bi和bo一般都要接近0,不然就是IO过于频繁,需要调整。
in 每秒CPU的中断次数,包括时间中断
cs 每秒上下文切换次数,例如我们调用系统函数,就要进行上下文切换,线程的切换,也要进程上下文切换,这个值要越小越好,太大了,要考虑调低线程或者进程的数目,例如在apache和nginx这种web服务器中,我们一般做性能测试时会进行几千并发甚至几万并发的测试,选择web服务器的进程可以由进程或者线程的峰值一直下调,压测,直到cs到一个比较小的值,这个进程和线程数就是比较合适的值了。系统调用也是,每次调用系统函数,我们的代码就会进入内核空间,导致上下文切换,这个是很耗资源,也要尽量避免频繁调用系统函数。上下文切换次数过多表示你的CPU大部分浪费在上下文切换,导致CPU干正经事的时间少了,CPU没有充分利用,是不可取的。
us 用户CPU时间,我曾经在一个做加密解密很频繁的服务器上,可以看到us接近100,r运行队列达到80(机器在做压力测试,性能表现不佳)。
sy 系统CPU时间,如果太高,表示系统调用时间长,例如是IO操作频繁。
id 空闲 CPU时间,一般来说,id + us + sy = 100,一般我认为id是空闲CPU使用率,us是用户CPU使用率,sy是系统CPU使用率。
wt 等待IO CPU时间。
// Add a new favorite using the service $scope.addFavorite = function(favorite) { FavoritesService.add(favorite).then(function () { $scope.favorites = FavoritesService.getFavorites(); $scope.hideModalAddFavorite(); }); };
// Delete a favorite using the service and update scope var $scope.deleteFavorite = function (favorite) { $scope.favorites = FavoritesService.delete(favorite); };
// Create the login modal that we will use later $ionicModal.fromTemplateUrl('templates/modals/login.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.loginModal = modal; });
// Triggered in the login modal to close it $scope.closeLogin = function() { InstagramService.loginCancelled(); $scope.loginModal.hide(); };
//Cleanup the modal when we're done with it! $scope.$on('$destroy', function() { $scope.loginModal.remove(); });
// Disable side-menu drag so that it doesnt interfere with our tinder cards functionality $scope.$on('$ionicView.enter', function() { $ionicHistory.clearHistory(); $ionicSideMenuDelegate.canDragContent(false); });
$scope.cardTransitionedLeft = function(index) { console.log('cardTransitionedLeft called with index:' + index); if (!InstagramService.isLoggedIn()) { console.log('not sure if you liked it before or not since you are not logged in; doing nothing!'); return; }
var post = $scope.model.currentPosts[index]; if (post.user_has_liked) { // jshint ignore:line PostsService.dislikePost(post.id) .success(function() { console.log('you disliked it!'); }); } else { console.log('you didnt like it in the first place!'); } };
$scope.cardTransitionedRight = function(index) { console.log('cardTransitionedRight called with index:' + index); if (!InstagramService.isLoggedIn()) { console.log('not sure if you liked it before or not since you are not logged in; if you login, we will like it for you'); }
var post = $scope.model.currentPosts[index]; if (!post.user_has_liked) { // jshint ignore:line PostsService.likePost(post.id) .success(function () { console.log('you liked it!'); }); } else { console.log('you already liked it previously!'); } };
$scope.cardDestroyed = function(index) { console.log('cardDestroyed called with index:' + index); $scope.model.currentPosts.splice(index, 1); };
Your Ionic project is readto go ! Some quick tips:
* cd into your project: $ cd trendicity
* Setup this project to use Sass: ionic setup sass
* Develop inthe browser with live reload: ionic serve
* Add aplatform (ios or Android): ionic platformadd ios [android] Note: iOS development requires OS X currently See the Android Platform Guide for full Android installation instructions: https://cordova.apache.org/docs/en/edge/guide_platforms_android_index.md.html
* Build your app: ionic build <PLATFORM>
* Simulate your app: ionic emulate <PLATFORM>
* Run your app onadevice: ionicrun <PLATFORM>
* Package an app using Ionic package service: ionic package <MODE> <PLATFORM>
For more help use ionic --help or ionic docs
Visit the Ionic docs: http://ionicframework.com/docs
New! Add push notifications to your Ionic app with Ionic Push (alpha)! https://apps.ionic.io/signup +---------------------------------------------------------+ + New Ionic Updates for August 2015 + + The View App just landed. Preview your apps onanydevice + http://view.ionic.io + + Invite anyone to preview and test your app + ionic share EMAIL + + Generate splash screens and icons with ionic resource + http://ionicframework.com/blog/automating-icons-and-splash-screens/ + +---------------------------------------------------------+
$ ionic serve ****************************************************** Upgrade warning - for the CLI to run correctly, it is highly suggested to upgrade the following: Please update your Node runtime to version >=0.12.x ****************************************************** Running live reload server: http://192.168.1.7:35729 Watching : [ 'www/**/*', '!www/lib/**/*' ] Running dev server: http://192.168.1.7:8100 Ionic server commands, enter: restart or r to restart the client app from the root goto or g and a url to have the app navigate to the given url consolelogs or c to enable/disable console log output serverlogs or s to enable/disable server log output quit or q to shutdown the server and exit