工作需要,要开始搞hadoop了,又是大数据,自己感觉大数据、云,只是ERP、SOAP风潮之后与智能地球一起诞生的概念炒作。不过Apache是个神奇的组织,Java如果没有它也不会现在如火中天。言归正传: 首先需要下载Apache hadoop 2.4.0的tar.gz包,到本地解压缩到
工作需要,要开始搞hadoop了,又是大数据,自己感觉大数据、云,只是ERP、SOAP风潮之后与智能地球一起诞生的概念炒作。不过Apache是个神奇的组织,Java如果没有它也不会现在如火中天。言归正传:
首先需要下载Apache hadoop 2.4.0的tar.gz包,到本地解压缩到某个盘下,注意路径里不要带空格。否则你配置文件里需要用windows 8.3格式的路径!
第二确保操作系统是64bit,已安装.netframework4.0以上版本,这个你懂的,微软的天下,没有这个怎么混!
第三确保安装了64 bit 版本的JDK1.7,笔者使用的就是JDK1.7.
第四请到github下载hadoop-commin-2.2.zip,官方下载的Apache hadoop 2.4.0的压缩包里,缺少windows下运行的链接库(hadoop.dll,winutils.exe,libwinutils.lib等),这个github的是大佬们编译好的64bit版的链接库包。下载直接解压缩,覆盖掉官方hadoop目录下的bin目录即可。
如果你想在windows下编译安装hadoop,则请直接参考官方原版文档:Hadoop2.X Windows安装指南
接下来进行配置(大部分摘抄自官方文档):
我的Hadoop解压缩目录是D:\Hadoop_2_4_0,以下简称h_home
首先,修改%h_home%\etc\hadoop的hadoop-env.cmd脚本文件,在文件末尾增加环境变量定义。注意找到文件最初的JAVA_HOME设置,改成你的64位JDK路径,这一点一定要注意!比如我的:“set JAVA_HOME=D:\OLD_JDK\jdk1.7.0_51”
set HADOOP_PREFIX=c:\deploy set HADOOP_CONF_DIR=%HADOOP_PREFIX%\etc\hadoop set YARN_CONF_DIR=%HADOOP_CONF_DIR% set PATH=%PATH%;%HADOOP_PREFIX%\bin
之后在该路径下找到或创建core-site.xml文件,修改内容如下:
<configuration> <property> <name>fs.default.name</name> <value>hdfs://0.0.0.0:19000</value> </property> </configuration>接下来是 hdfs-site.xml 文件,一样的修改内容如下。配置文件默认使用\tmp目录作为hdfs文件的存储位置,比如我解压hadoop在D:\下,则它就会创建D:\tmp来存放HDFS文件系统。
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>基本配置ok。
接下来我们配置一个YARN示例:
还是在该配置文件路径下,修改或者创建一个mapred-site.xml文件,路径下有个同名的模板文件,可以直接复制,然后修改其中的内容。注意替换配置文件中%USERNAME% 为你windows的用户名。
<configuration> <property> <name>mapreduce.job.user.name</name> <value>%USERNAME%</value> </property> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>yarn.apps.stagingDir</name> <value>/user/%USERNAME%/staging</value> </property> <property> <name>mapreduce.jobtracker.address</name> <value>local</value> </property> </configuration>
最后,创建yarn-site.xml文件,变更内容如下:
<configuration> <property> <name>yarn.server.resourcemanager.address</name> <value>0.0.0.0:8020</value> </property> <property> <name>yarn.server.resourcemanager.application.expiry.interval</name> <value>60000</value> </property> <property> <name>yarn.server.nodemanager.address</name> <value>0.0.0.0:45454</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> <property> <name>yarn.server.nodemanager.remote-app-log-dir</name> <value>/app-logs</value> </property> <property> <name>yarn.nodemanager.log-dirs</name> <value>/dep/logs/userlogs</value> </property> <property> <name>yarn.server.mapreduce-appmanager.attempt-listener.bindAddress</name> <value>0.0.0.0</value> </property> <property> <name>yarn.server.mapreduce-appmanager.client-service.bindAddress</name> <value>0.0.0.0</value> </property> <property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property> <property> <name>yarn.log-aggregation.retain-seconds</name> <value>-1</value> </property> <property> <name>yarn.application.classpath</name> <value>%HADOOP_CONF_DIR%,%HADOOP_COMMON_HOME%/share/hadoop/common/*,%HADOOP_COMMON_HOME%/share/hadoop/common/lib/*,%HADOOP_HDFS_HOME%/share/hadoop/hdfs/*,%HADOOP_HDFS_HOME%/share/hadoop/hdfs/lib/*,%HADOOP_MAPRED_HOME%/share/hadoop/mapreduce/*,%HADOOP_MAPRED_HOME%/share/hadoop/mapreduce/lib/*,%HADOOP_YARN_HOME%/share/hadoop/yarn/*,%HADOOP_YARN_HOME%/share/hadoop/yarn/lib/*</value> </property> </configuration>ok,全部配置都改完了。点击命令提示符(管理员)运行命令提示符,切换到hadoop的安装目录。进行以下操作
1、切换到etc/hadoop目录,运行hadoop-env.cmd脚本,设置当前命令窗口执行环境变量。
2、格式化HDFS文件系统(建议切换到bin目录然后执行命令):
%HADOOP_PREFIX%\bin\hdfs namenode -format
3、运行HDFS示例:
%HADOOP_PREFIX%\sbin\start-dfs.cmd不报错的话,部署就ok了!!!

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Linux new version
SublimeText3 Linux latest version
