首页 文章 精选 留言 我的

精选列表

搜索[多云部署],共10000篇文章
优秀的个人博客,低调大师

Elasticsearch-1.7.0安装部署

1、首先去elasticsearch官网下载软件包版本1.7.0版本. 1 #wgethttps://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.0.tar.gz 2、解压elasticsearch-1.7.0.tar.gz 软件包. 1 #tarzxfelasticsearch-1.7.0.tar.gz 3、es配置文件参数解释(真正配置不全用的到): #集群名称标识了你的集群,自动探查会用到它。 #如果你在同一个网络中运行多个集群,那就要确保你的集群名称是独一无二的. 1 cluster.name: test -elasticsearch #节点名称会在启动的时候自动生成,所以你可以不用手动配置。你也可以给节点指定一个特定的名称. 1 node.name: "elsearch1" #允许这个节点被选举为一个主节点(默认为允许) 1 #node.master:true #允许这个节点存储数据(默认为允许) 1 #node.data:true #You can exploit these settings to design advanced cluster topologies. # 你可以利用这些设置设计高级的集群拓扑 # # 1. You want this node to never become a master node, only to hold data. # This will be the "workhorse" of your cluster. # 1. 你不想让这个节点成为一个主节点,只想用来存储数据。 # 这个节点会成为你的集群的“负载器” # 1 2 #node.master:false #node.data:true #You want this node to only serve as a master: to not store any data and # to have free resources. This will be the "coordinator" of your cluster. # 2. 你想让这个节点成为一个主节点,并且不用来存储任何数据,并且拥有空闲资源。 # 这个节点会成为你集群中的“协调器” 1 2 #node.master:true #node.data:false # Use the Cluster Health API [http://localhost:9200/_cluster/health], the # Node Info API [http://localhost:9200/_nodes] or GUI tools #使用集群体检API[http://localhost:9200/_cluster/health] , # 节点信息API[http://localhost:9200/_cluster/nodes] 或者GUI工具例如: # A node can have generic attributes associated with it, which can later be used # for customized shard allocation filtering, or allocation awareness. An attribute # is a simple key value pair, similar to node.key: value, here is an example: # 一个节点可以附带一些普通的属性,这些属性可以在后面的自定义分片分配过滤或者allocation awareness中使用。 # 一个属性就是一个简单的键值对,类似于node.key: value, 这里有一个例子: 1 #node.rack:rack314 # By default, multiple nodes are allowed to start from the same installation location # to disable it, set the following: # 默认的,多个节点允许从同一个安装位置启动。若想禁止这个特性,按照下面所示配置: 1 #node.max_local_storage_nodes:1 # Set the number of shards (splits) of an index (5 by default): # 设置一个索引的分片数量(默认为5) 1 #index.number_of_shards:5 # Set the number of replicas (additional copies) of an index (1 by default): # 设置一个索引的副本数量(默认为1) 1 #index.number_of_replicas:1 # Note, that for development on a local machine, with small indices, it usually # makes sense to "disable" the distributed features: # 注意,为了使用小的索引在本地机器上开发,禁用分布式特性是合理的做法。 1 2 #index.number_of_shards:1 #index.number_of_replicas:0 # Path to directory containing configuration (this file and logging.yml): # 包含配置(这个文件和logging.yml)的目录的路径 1 #path.conf:/path/to/conf # Path to directory where to store index data allocated for this node. # 存储这个节点的索引数据的目录的路径 1 #path.data:/path/to/data # Can optionally include more than one location, causing data to be striped across # the locations (a la RAID 0) on a file level, favouring locations with most free # space on creation. For example: # 可以随意的包含不止一个位置,这样数据会在文件层跨越多个位置(a la RAID 0),创建时会 # 优先选择大的剩余空间的位置 1 #path.data:/path/to/data1,/path/to/data2 # Path to temporary files: # 临时文件的路径 1 #path.work:/path/to/work # Path to log files: # 日志文件的路径 1 #path.logs:/path/to/logs # Path to where plugins are installed: # 插件安装路径 1 #path.plugins:/path/to/plugins # If a plugin listed here is not installed for current node, the node will not start. # 如果当前结点没有安装下面列出的插件,结点不会启动 1 #plugin.mandatory:mapper-attachments,lang-groovy # ElasticSearch performs poorly when JVM starts swapping: you should ensure that # it _never_ swaps. # 当JVM开始swapping(换页)时ElasticSearch性能会低下,你应该保证它不会换页 # Set this property to true to lock the memory: # 设置这个属性为true来锁定内存 1 #bootstrap.mlockall:true # Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set # to the same value, and that the machine has enough memory to allocate # for ElasticSearch, leaving enough memory for the operating system itself. # 确保ES_MIN_MEM和ES_MAX_MEM环境变量设置成了同一个值,确保机器有足够的内存来分配 # 给ElasticSearch,并且保留足够的内存给操作系统 # You should also make sure that the ElasticSearch process is allowed to lock # the memory, eg. by using `ulimit -l unlimited`. # 你应该确保ElasticSearch的进程可以锁定内存,例如:使用`ulimit -l unlimited` # ElasticSearch, by default, binds itself to the 0.0.0.0 address, and listens # on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node # communication. (the range means that if the port is busy, it will automatically # try the next port). # 默认的ElasticSearch把自己和0.0.0.0地址绑定,HTTP传输的监听端口在[9200-9300],节点之间 # 通信的端口在[9300-9400]。(范围的意思是说如果一个端口已经被占用,它将会自动尝试下一个端口) # Set the bind address specifically (IPv4 or IPv6): # 设置一个特定的绑定地址(IPv4 or IPv6): 1 #network.bind_host:192.168.0.1 # Set the address other nodes will use to communicate with this node. If not # set, it is automatically derived. It must point to an actual IP address. # 设置其他节点用来与这个节点通信的地址。如果没有设定,会自动获取。 # 必须是一个真实的IP地址。 1 #network.publish_host:192.168.0.1 # Set both 'bind_host' and 'publish_host': # 'bind_host'和'publish_host'都设置 1 #network.host:192.168.0.1 # Set a custom port for the node to node communication (9300 by default): # 为节点之间的通信设置一个自定义端口(默认为9300) 1 #transport.tcp.port:9300 # Enable compression for all communication between nodes (disabled by default): # 为所有的节点间的通信启用压缩(默认为禁用) 1 #transport.tcp.compress:true # Set a custom port to listen for HTTP traffic: # 设置一个监听HTTP传输的自定义端口 1 #http.port:9200 # Set a custom allowed content length: # 设置一个自定义的允许的内容长度 1 #http.max_content_length:100mb # Disable HTTP completely: # 完全禁用HTTP 1 #http.enabled:false 3、操作系统配置 1.文件描述符 1 2 3 vim /etc/security/limits .conf添加 *softnofile655350 *hardnofile655350 退出当前用户重新login就会生效,使用ulimit -n验证下。 2.最大内存映射区数量,禁用swap交换分区 1 2 3 4 5 vim /etc/sysctl .conf增加 vm.max_map_count=262144 vm.swappiness=1 修改完成后sysctl-p jvm参数配置 ES_HOME的bin目录下有一个elasticsearch.in.sh文件,修改 1 2 ES_MIN_MEM=256m ES_MAX_MEM=1g 为合适的值 4、es的插件安装: Marvel是Elasticsearch的管理和监控工具,对于开发使用免费的。它配备了一个叫做Sense的交互式控制台,方便通过浏览器直接与Elasticsearch交互。 Marvel是一个插件,在Elasticsearch目录中运行以下代码来下载和安装: 1 . /plugin -ielasticsearch /marvel/latest elasticsearch-head是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序,你可以通过插件把它集成到es。 1 #./plugin-installmobz/elasticsearch-head 地址:http://172.16.2.24:25556/_plugin/head/ elasticsearch插件bigdesk安装: bigdesk是elasticsearch的一个集群监控工具,可以通过它来查看es集群的各种状态,如:cpu、内存使用情况,索引数据、搜索情况,http连接数等。 在cmd命令行中进入安装目录,再进入 bin目录,运行以下命令: 1 #./plugin-installlukas-vlcek/bigdesk 在浏览器中输入:http://172.16.2.24:25556/_plugin/bigdesk可以看到效果 注意:elasticsearch 分词ik的安装,如果不安装分词ik插件,根本建不了索引,并且让访问http://172.16.2.24:25556/_plugin/head/ 集群一片空白,点击web 创建索引页没有反应。 注意:github https://github.com/medcl/elasticsearch-analysis-ik 给出了对应的es的ik版本,1.7.0的es对应的1.2.6的版本,开始我这块装了1.8的ik,创建索引失败,后台也是报ik的错误。 ik:1.2.6版本的下载:https://github.com/medcl/elasticsearch-analysis-ik/releases?after=v1.6.1 安装操作: 下载zip包解压到一个目录解压缩: 1 #unzipelasticsearch-analysis-ik-master.zip 安装mavne环境,apache 官网下载软件包设置环境变量: 1 #exportPATH=$PATH:/usr/local/maven/bin 因为是源代码,此处需要使用maven打包,进入解压文件夹中,执行命令: 1 2 #cdelasticsearch-analysis-ik-master #mvncleanpackage #在es的plugin目录下创建ik目录,并将target目录下的elasticsearch-analysis-ik-1.2.6.jar copy 到ik目录下。 1 2 3 4 5 6 7 8 9 [root@localhosttarget] #cd/data/elasticsearch-1.7.0 [root@localhostelasticsearch-1.7.0] #ls binconfigdatalibLICENSE.txtlogsNOTICE.txtpluginsREADME.textile [root@localhostelasticsearch-1.7.0] #cdplugins/ [root@localhostplugins] #ls bigdesk head ikmarvel [root@localhostplugins] #cdik/ [root@localhostik] #ls elasticsearch-analysis-ik-1.2.6.jar 注意:如果是集群,可以将jar分别copy至其他几台机器。 es配置文件需要添加入下行: 1 2 3 4 5 6 7 8 9 10 11 12 13 index: analysis: analyzer: ik: alias :[ik_analyzer] type :org.elasticsearch.index.analysis.IkAnalyzerProvider ik_max_word: type :ik use_smart: false ik_smart: type :ik use_smart: true marvel.agent.enabled: false 完整的es配置文件如下,三台同样的配置,除了hostip和node.name外. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #catelasticsearch.yml cluster.name: test -es-cluster network.host:172.16.2.24 node.name: "node24" discovery.zen. ping .unicast.hosts:[ "172.16.2.24:25555" , "172.16.2.21:25555" , "172.16.2.23:25555" ] index.number_of_shards:5 discovery.zen.minimum_master_nodes:2 script.groovy.sandbox.enabled: false transport.tcp.port:25555 http.port:25556 script.inline:off script.indexed:off script. file :off index: analysis: analyzer: ik: alias :[ik_analyzer] type :org.elasticsearch.index.analysis.IkAnalyzerProvider ik_max_word: type :ik use_smart: false ik_smart: type :ik use_smart: true marvel.agent.enabled: false 后台启动es服务: 1 2 3 [root@localhostbin] #pwd /data/elasticsearch-1 .7.0 /bin [root@localhostbin] #./elasticsearch-d 三台集群的机器中找其中一台创建索引: 创建索引: 1 2 curl-XPUT 'http://172.16.2.24:25556/index' { "acknowledged" : true } 注意:返回结果为acknowledged":true 为成功. 通过浏览器访问:http://172.16.2.24:25556/_plugin/head/测试效果. 本文转自青衫解衣 51CTO博客,原文链接:http://blog.51cto.com/215687833/1927264

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

cloudera 部署Hadoop 更方便

注意:以下操作对应 rhel5/centos5 1 获取cdh3 yum 源 wget-chttp://archive.cloudera.com/redhat/cdh/cdh3-repository-1.0-1.noarch.rpm 2 安装下载的rpm 包 yum--nogpgchecklocalinstallcdh3-repository-1.0-1.noarch.rpm //安装后将得到cloudera-cdh3.repo 文件 [root@namenode~]#ll/etc/yum.repos.d/ total40 -rw-r--r--1rootroot1926Aug292011CentOS-Base.repo -rw-r--r--1rootroot631Aug292011CentOS-Debuginfo.repo -rw-r--r--1rootroot626Aug292011CentOS-Media.repo -rw-r--r--1rootroot5390Aug292011CentOS-Vault.repo -rw-r--r--1rootroot201Jul142011cloudera-cdh3.repo 3 导入 rpm key rpm--importhttp://archive.cloudera.com/redhat/cdh/RPM-GPG-KEY-cloudera 4 安装 hadoop 主程序 yuminstallhadoop-0.20 5 hadoop <daemon type> namenode datanode secondarynamenode jobtracker tasktracker //比如安装 namenode 为: yum install hadoop-0.20-datanode,不同角色安装不同服务 6 安装后 hadoop 目录 //hadoop配置文件目录 [root@namenode~]#ll/etc/hadoop/ total8 lrwxrwxrwx1rootroot34Feb1702:56conf->/etc/alternatives/hadoop-0.20-conf drwxr-xr-x2rootroot4096Feb2810:13conf.empty drwxr-xr-x2rootroot4096Feb2810:15conf.pseudo //hadoop日志目录 [root@namenode~]#ll/var/log/hadoop lrwxrwxrwx1rootroot28Feb1702:56/var/log/hadoop->/etc/alternatives/hadoop-log //hadoop进程脚本 [root@namenode~]#ll/etc/init.d/|grephadoop -rwxr-xr-x1rootroot3041Feb1702:26hadoop-0.20-datanode -rwxr-xr-x1rootroot3067Feb1702:26hadoop-0.20-jobtracker -rwxr-xr-x1rootroot3041Feb1702:26hadoop-0.20-namenode -rwxr-xr-x1rootroot3158Feb1702:26hadoop-0.20-secondarynamenode -rwxr-xr-x1rootroot3080Feb1702:26hadoop-0.20-tasktracker 7 修改配置文档 (hdfs 方面) //slaves配置文件namenode上配置即可 cat/etc/hadoop/conf/slaves datanode1 datanode2 //hdfs-site.xml配置文件 cat/etc/hadoop/conf/hdfs-site.xml <?xmlversion="1.0"?> <?xml-stylesheettype="text/xsl"href="configuration.xsl"?> <!--Putsite-specificpropertyoverridesinthisfile.--> <configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.permissions</name> <value>false</value> </property> <!--ImmediatelyexitsafemodeassoonasoneDataNodechecksin. Onamulti-nodecluster,theseconfigurationsmustberemoved.--> <property> <name>dfs.safemode.extension</name> <value>0</value> </property> <property> <name>dfs.safemode.min.datanodes</name> <value>1</value> </property> <!-- <property> specifythissothatrunning'hadoopnamenode-format'formatstherightdir <name>dfs.name.dir</name> <value>/var/lib/hadoop-0.20/cache/hadoop/dfs/name</value> </property> --> <!--addbydongnan--> <property> <name>dfs.data.dir</name> <value>/data/dfs/data</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/data/dfs/tmp</value> </property> <property> <name>dfs.datanode.max.xcievers</name> <value>200000</value> </property> </configuration> //core-site.xml配置文件 cat/etc/hadoop/conf/core-site.xml <?xmlversion="1.0"?> <?xml-stylesheettype="text/xsl"href="configuration.xsl"?> <!--Putsite-specificpropertyoverridesinthisfile.--> <configuration> <property> <name>fs.default.name</name> <value>hdfs://namenode:8020</value> </property> </configuration> 8 java 环境 //下载安装jdk chmod+xjdk-6u26-linux-x64-rpm.bin ./jdk-6u26-linux-x64-rpm.bin //编辑profile vim/etc/profile exportJAVA_HOME=/usr/java/jdk1.6.0_26 exportPATH=$JAVA_HOME/bin:$PATH //载入环境变量 souce /etc/profile 9 启动hadoop 相应进程 [root@namenode~]#/etc/init.d/hadoop-0.20-namenodestart [root@namenode~]#jps 5599NameNode 12889Jps 本文转自 dongnan 51CTO博客,原文链接: http://blog.51cto.com/dngood/791719

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

MySQL5.6 部署MHA

趁着最近几天休息,就把之前没有补全的博客也来补补。 今天就和大家聊聊MySQL高可用方案中的MHA 在中小型架构中,针对MySQL做高可用 用的最多的可能就是keepalived/heartbeat+MySQL Replication。 这种方案配置简单、维护方便,并且也能实现MySQL的故障转移,因此更多的倾向于此架构 MHA是什么? MHA是由日本Mysql专家用Perl写的一套Mysql故障切换方案,来保障数据库的高可用性,它的功能是能在0-30s之内实现主Mysql故障转移(failover),MHA故障转移可以很好的帮我们解决从库数据的一致性问题,同时最大化挽回故障发生后数据的一致性。 MHA里有两个角色一个是node节点一个是manager节点,要实现这个MHA,必须最少要三台数据库服务器,一主多备,即一台充当master,一台充当master的备份机,另外一台是从属机,这里实验为了实现更好的效果使用四台机器,需要说明的是一旦主服务器宕机,备份机即开始充当master提供服务,如果主服务器上线也不会再成为master了,因为如果这样数据库的一致性就被改变了 这里有一个mha的网络拓扑图,我们先来简单的介绍下 先来聊聊这个拓扑图,文章开篇也有过介绍,MHA有两个重要的角色,一个是manager,另外一个是node; 从这个拓扑图中,或许大家不难分辨出如下信息 1 2 3 4 192.168.1.117manager管理节点 192.168.1.116master主库 192.168.1.118slave01从库+备库 192.168.1.119slave02从库 一、环境初始化 1、修改主机名 1 2 3 4 5 6 7 8 主机:manager执行命令 #sed-i's/HOSTNAME=.*/HOSTNAME=manager/g'/etc/sysconfig/network&&hostnamemanager 主机:master执行命令 #sed-i's/HOSTNAME=.*/HOSTNAME=master/g'/etc/sysconfig/network&&hostnamemaster 主机:slave01执行命令 #sed-i's/HOSTNAME=.*/HOSTNAME=slave01/g'/etc/sysconfig/network&&hostnameslave01 主机:slave02执行命令 #sed-i's/HOSTNAME=.*/HOSTNAME=slave02/g'/etc/sysconfig/network&&hostnameslave02 2、主机名解析 1 2 3 4 5 本文转自zys467754239 51CTO博客,原文链接:http://blog.51cto.com/467754239/1695175,如需转载请自行联系原作者

资源下载

更多资源
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应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册