Find and share helpful community-sourced technical articles
Recently active
PROBLEM:Click Alerts and then Actions > Manage Alert Group -> Custom Alert Group.Then, click the + sign on the right side and pick any alert definition and press OK. Click Save and you will see the 500(server error) Server Error on the alert group screen:And in the ambari-server.log there is error:WARN [qtp-ambari-client-510524] ServletHandler:563 - /api/v1/clusters/<cluster-name>/alert_groups/155java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429) at java.util.HashMap$KeyIterator.next(HashMap.java:1453) at org.eclipse.persistence.indirection.IndirectSet$1.next(IndirectSet.java:471) at org.apache.ambari.server.orm.entities.AlertGroupEntity.setAlertTargets(AlertGroupEntity.java:313) at org.apache.ambari.server.controller.internal.AlertGroupResourceProvider.updateAlertGroups(AlertGroupResourceProvider.java:344) at org.apache.ambari.server.controller.internal.AlertGroupResourceProvider.access$100(AlertGroupResourceProvider.jav
Here is a simple example--Running a Select count inside Beeline for a table by name patb0: jdbc:hive2://node1:10000> select * from patb;| patb.ida | patb.name | patb.month || 5 | Ujjain | 6 |1 row selected (0.388 seconds)Now we go ahead and set a variable.0: jdbc:hive2://node1:10000> set hivevar:tablename=patb;No rows affected (0.005 seconds)0: jdbc:hive2://node1:10000> select * from ${hivevar:tablename};| patb.ida | patb.name | patb.month || 5 | Ujjain | 6 |1 row selected (0.14 seconds)Resolution: Please set the variable as set hivevar:tablename=patb;
Consider the example:Total input paths = 7 Input size for job = 510K1) While are using a custom InputFormat which extends ‘org.apache.hadoop.mapred.FileInputFormat’ and having ‘isSplitable’ as false.Expected : 7 splits [As FileInputFormat doesn't split file smaller than blockSize (128 MB) so there should be one split per file] Actual: 4 splits 2) Default value for 'hive.input.format' is CombineHiveInputFormat. After setting ‘set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;’, there are 7 splits as expected. From above two points, it looks hive uses ‘CombineHiveInputFormat’ on top of the custom InputFormat to determine number of splits. How splits were calculated:For deciding the number of mappers when using CombineInputFormat, data locality plays a role. Now to find where those files belong we can get it from command: hadoop fsck /<file-path> -files -blocks -locations 1. On. a.a.a.a/user/user1/hive/split/file1_0000[/default-rack/a.a.a.a:1019, /default-rack/
PROBLEM:After moving the Zookeeper servers and setting correctly in the yarn configs, Resource managers come up but are in standby state.Even after removing the znode - rmstore, none of the nodes transition to active.ROOT CAUSE:Zookeeper data is stored in znode yarn-leader-election. This is used for RM leader election. This znode has stale data about zookeeper leader.RESOLUTION:1. Login into zkcli2. rmr /yarn-leader-election3. Restart Resource managers.
Customer has a Hive Query with a Group By Clause and is stuck on the last Reducer. This looks like a Reducer Skew in the Group By Clause.You may please use the below said configuration in the Hive CLI at the session level.Inside the Hive CLI.set hive.groupby.skewindata=true;<Run the Query>
SYMPTOM: FAILED: SemanticException [Error 10122]: Bucketized tables do not support INSERT INTO: Table: XXXXROOT CAUSE: Customer has a ACID enabled Cluster. Customer created a Table for which the TBLPROPERTIES ('transactional'='true') was not set. Customer's table has 50 Billion records in it.WORKAROUND: For a table to be transactional, we need to set TBLPROPERTIES ('transactional'='true') We can convert a table to Transactional Table using the Alter Table Command, assuming the table satisfies acid requirements --Bucketed,--Using ORC--Not sorted.RESOLUTION: Logically alter table to set transactional=true is supported.
PROBLEM: When the hostname is mixed like: 172.26.93.148 GRAFANA-hdp253-s1.openstacklocal GRAFANA-hdp253-s1 172.26.93.149 GRAFANA-hdp253-s2.openstacklocal GRAFANA-hdp253-s2 172.26.93.150 GRAFANA-hdp253-s3.openstacklocal GRAFANA-hdp253-s3 Ambari creates the datasource with a lower case hostname:Once you enter the hostname with mixed case, Grafana works:RESOLUTION Grafana 2.6.0 backend uses Go 1.5. Go's DNS lookup had a bug where the look up is case sensitive: https://github.com/golang/go/issues/12806 We can manual workaround by using the original casing in the Grafana Data Source URL as mentioned in the description. Another workaround is to update the /etc/hosts file to have all lowercase patterns as well. This bug was fixed in Go 1.6, so we will no longer have this issue once we upgrade Grafana to a later version (say 4.1.x) in a future version of Ambari.
PROBLEM:To run Hive in Silent Mode. HOW TO hive -S -e "Show databases" For example: hive -S -e "show databases;" SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/spark/lib/spark-assembly-1.4.1.2.3.2.0-2950-hadoop2.7.1.2.3.2.0-2950.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] WARNING: Use "yarn jar" to launch YARN applications. SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/spark/lib/spark-assembly-1.4.1.2.3.2.0-2950-hadoop2.7.1.2.3.2.0-2950.jar!/org/slf4
Please log on to the backend database: mysql> use hive; Database changed: mysql> show tables; The table of importance to us in this scenario is HIVE_LOCKS. (MySQL is sensitive to Upper and Lower Caps) mysql> describe HIVE_LOCKS;+---------------------+--------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+---------------------+--------------+------+-----+---------+-------+| HL_LOCK_EXT_ID | bigint(20) | NO | PRI | NULL | || HL_LOCK_INT_ID | bigint(20) | NO | PRI | NULL | || HL_TXNID | bigint(20) | YES | MUL | NULL || HL_DB | varchar(128) | NO | | NULL | || HL_TABLE | varchar(128) | YES | | NULL | || HL_PARTITION | varchar(767) | YES | | NULL | || HL_LOCK_STATE | char(1) | NO | | NULL | || HL_LOCK_TYPE | char(1) | NO | | NULL | || HL_LAST_HEARTBEAT | bigint(20) | NO | | NULL | || HL_ACQUIRED_AT | bigint(20) | YES | | NULL | || HL_USER | varchar(128) | NO | | NULL | || HL_HOST | varchar(128) | NO | | NULL | || HL_HEARTBEAT_COUNT | int(11) |
PROBLEM: For example, while running from shell, we usually append the single quotes around the date type: hive> select * from students where datestamp='2014-09-23'; OKfred flintstone351.282014-09-23 Time taken: 0.761 seconds, Fetched: 1 row(s) But in case of Hue, internally it doesn't append these single quotes and throws error on browse data. STEPS TO REPRODUCE: 1. Create table: CREATE TABLE students(name varchar(64), age int, gpa decimal(3,2)) PARTITIONED BY ( datestamp date);2. Insert: INSERT INTO TABLE students PARTITION (datestamp = '2014-09-23') VALUES ('fred flintstone', 35, 1.28);3. Login into hue -> Go to HCatalog -> Tables -> select 'students' -> Click on Browse data 4. This will generate error:RESOLUTION: There is an internal bug reported. Please reach out to support.
While designing your flow, one will think of handling failures as well. Some may ignore (terminate) it while some may want to analyze their failed flow files. You can view/download any flowfile in the connection via NiFi UI. However if there are multiple flowfiles then this becomes little tedious since you have to do it for each flowfile. . In that case, I used below flow to put all failed flow files to a temp location on my nifi node and then access it from there for further analysis. In this I am generating random 2B text file and passing it to FTP server. If FTP server is unreachable it will put all flow files to failure/reject queue. You can list all files in this queue. I have viewed one such file in image below. Then all these files are passed to PutFile processor which is configured to write all the files it receives to /tmp/test location on the nifi node. Please note: There could be multiple ways to do this. This is the approach used by me to quickly download all failed flow
I didn't want to clear the ATS and lose all the job history. I wanted to fix the corruption and preserve the ATS leveldb entries. 2017-06-15 19:17:43,871 INFO service.AbstractService (AbstractService.java:noteFailure(272)) - Service org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryServer failed in state INITED; cause: org.apache.hadoop.service.ServiceStateException: org.fusesource.leveldbjni.internal.NativeDB$DBException: Corruption: 43 missing files; e.g.: /data/hadoop/ats/leveldb/leveldb-timeline-store/domain-ldb/000015.sst <snipped>2017-06-15 19:17:43,871 INFO impl.MetricsSystemImpl (MetricsSystemImpl.java:stop(211)) - Stopping ApplicationHistoryServer metrics system... 2017-06-15 19:17:43,873 INFO impl.MetricsSinkAdapter (MetricsSinkAdapter.java:publishMetricsFromQueue(141)) - timeline thread interrupted. 2017-06-15 19:17:43,875 INFO impl.MetricsSystemImpl (MetricsSystemImpl.java:stop(217)) - ApplicationHistoryServer metrics system stopped. 2017-06-15
PROBLEM: We see below message on initial runs:2017-02-28 19:37:48,681 INFO [main] impl.TimelineClientImpl: Timeline service address: http://<timeline-server-hostname>:8188/ws/v1/timeline/ 2017-02-28 19:37:48,823 INFO [main] client.AHSProxy: Connecting to Application History server at <history-server-hostname>/<history-server-ip>:10200 2017-02-28 19:37:49,016 WARN [main] ipc.Client: Failed to connect to server: <resource-manager-A>/<resource-manager-A-ip>:8032: retries get failed due to exceeded maximum allowed retries number: 0 java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)ROOT CAUSE: In Yarn configs -> custom yarn-site.xml, you might have configuration for rm1 as resource-manager-
This is a known issue https://issues.apache.org/jira/browse/NIFI-3800 which is fixed in Apache NiFi 1.2.0 (HDF 2.1.4 and later) Workaround: You can downgrade your Java version to openjdk-1.8.0_121 if you are using something higher than that.
SYMPTOM :Hive query with group by clause stuck in reducer phase for a very long time having large amount of dataROOT CAUSE:This happens in the case when GROUPBY clause is not optimized. By default Hive puts the data with the same group-by keys to the same reducer. If the distinct value of the group-by columns has data skew, one reducer may get most of the shuffled data and will be stuck for a very long time on this reducer. WORKAROUND:In this case increasing the tez container memory will not help. We can avoid data skewness using the following properties before running the query,>set hive.tez.auto.reducer.parallelism=true >set hive.groupby.skewindata=true ; >set hive.optimize.skewjoin=true;
This is due to a setting in yarn-site.xml:yarn.resourcemanager.fs.state-store.retry-policy-specHere is an example: yarn.resourcemanager.fs.state-store.retry-policy-spec: 2000,500It is specified in pairs of sleep-time and number-of-retriesThis will mean that Hive Client will try connecting to nn1 for 500 times at an interval of 2000 Milliseconds.Contingent on the fact that it could not connect to nn1 for 500 times at an interval of 2000 Milliseconds, it will then try connecting to nn2.Resolution/Workaround: Lower the value of yarn.resourcemanager.fs.state-store.retry-policy-spec to 1000,10.
ISSUE : Hive Metastore stops responding until a restart happens.WORKAROUND : Please collect the jstack output 5 times at an interval of 30 seconds when hivemetastore is hung.jstack -F <hivemetastorepid> > jstack.out Then analyze the jstack output and look for the keyword "locked".If you see something similar to below then there are locked threads with respect to filesystem cache."pool-5-thread-180" #12021 prio=5 os_prio=0 tid=0x00007f63de37e000 nid=0x3900 runnable [0x00007f6391fc3000] java.lang.Thread.State: RUNNABLEat org.apache.hadoop.fs.FileSystem$Cache.closeAll(FileSystem.java:2886)- locked <0x00000005c0032ca8> (a org.apache.hadoop.fs.FileSystem$Cache)at org.apache.hadoop.fs.FileSystem.closeAllForUGI(FileSystem.java:473)at org.apache.hadoop.hive.metastore.TUGIBasedProcessor.process(TUGIBasedProcessor.java:131)Please add the following to hive-site.xml and restart Hive services. These properties will disable the hdfs filesystem cache.fs.hdfs.impl.disable.cache=true
# SANDBOX must have only Host-only network, quorum is sandbox.hortonworks.com /etc/hosts is 192.168.56.101 sandbox.hortonworks.com# create an hbase table from hiveCREATE TABLE IF NOT EXISTS hbase_hive_table(key string, value string)STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:json")TBLPROPERTIES ("hbase.table.name" = "hbase_hive_table");# in hbase shell access the tablehbase(main):001:0> describe 'hbase_hive_table'Table hbase_hive_table is ENABLEDhbase_hive_table COLUMN FAMILIES DESCRIPTION{NAME => 'cf', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}1 row(s) in 0.2860 seconds# insert into HBase table through HiveINSERT OVERWRITE TABLE HBASE_HIVE_TABLE SELECT CODE, DESCRIPT
SYMPTOM Select statement fails for view with different orderingFAILING QUERIES: select id, dept, emp, fname from testview order by id, dept; select id, emp, dept, fname from testview order by id, dept;select emp, dept, id, fnamefrom testview order by id, dept;SUCCESSFUL QUERIES:select emp, fname, id, dept from testview order by id, dept; select emp, citystate, fname, dept from testview order by id, dept;select emp, fname, dept, id from testview order by id, dept;EXCEPTION:Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating VALUE._col1 at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:86) at org.apache.hadoop.hive.ql.exec.tez.ReduceRecordSource$GroupIterator.next(ReduceRecordSource.java:343) ... 17 moreCaused by: java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.hadoop.io.Text.set(Text.java:225) at org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryHiveVarchar.init(LazyBinaryHiveVarcha
PROBLEM DESCRIPTION:Flume agent configured without any sources fails to start in Ambari. However, a message in the service status log indicates that the flume agent has started successfully. The following sample configuration file works in flume node if ran manually with flume-ng command. However, the same configuration fails with Ambari.# Flume agent configagent1.sinks = HdfsSink1agent1.channels = channel1agent1.channels.channel1.type=org.apache.flume.channel.kafka.KafkaChannelagent1.channels.channel1.brokerList=node11.openstacklocal:6667agent1.channels.channel1.kafka.topic=testagent1.channels.channel1.zookeeperConnect=node11.openstacklocal:2181agent1.channels.channel1.capacity=10000agent1.channels.channel1.transactionCapacity=1000agent1.channels.channel1.parseAsFlumeEvent=falseagent1.channels.channel1.kafka.consumer.group.id=test.hdfs-cagent1.sinks.HdfsSink1.channel=channel1agent1.sinks.HdfsSink1.hdfs.appendTimeout=10000agent1.sinks.HdfsSink1.hdfs.batchSize=1000agent1.sinks.HdfsSink
While this article provides a mechanism through which we could setup Spark with HiveContext, there are some limitation that when using Spark with HiveContext. For e.x Hive support writing query result to HDFS using the "INSERT OVERWRITE DIRECTORY" i.e INSERT OVERWRITE DIRECTORY 'hdfs://cl1/tmp/query'SELECT * FROM REGIONAbove command will result is writing the result of above query to HDFS. However if the same query is passed to Spark with HiveContext, this will fail since "INSERT OVERWRITE DIRECTORY" is not a supported feature when using Spark. This is tracked via this jira. If the same needs to be achieved via spark -- it could achieved by using the Spark CSV library ( required in case of Spark1 ).Below is the code snippet on how to achieve the same.DataFrame df = hiveContext.sql("SELECT * FROM REGION"); df.write() .format("com.databricks.spark.csv") .option("delimiter", "\u0001") .save("hdfs://cl1/tmp/query");Above command will save the result in HDFS under dir /tm
By default, Cloudbreak uses a built-in PostgreSQL database to persist data. For production environments, we suggest that you use an external database, an RDS served by your cloud provider. If you choose to use the default database, you should know that Cloudbreak deployer includes features for dumping and restoring built-in databases. Cloudbreak deployer uses Docker for the underlying infrastructure and uses Docker volume for storing data. There are two separate volumes:a volume called `common` for storing live dataa volume called `cbreak_dump` for database dumps You can override default live data volume any time by extending your `Profile` with the following variable: export COMMON_DB_VOL="my-live-data-volume" To create database dumps, execute the following commands: cbd db dump common cbdbcbd db dump common uaadbcbd db dump common periscopedb The dump command has an optional third parameter, the `name` of the dump. If you give your dump a name, Cloudbreak deployer will cre
SYMPTOMCREATE EXTERNAL TABLE test(id STRING,dept STRING)row format delimitedfields terminated by ','location '/user/hdfs/testdata/';ROOT CAUSEThe files under location provided while creating table are structured in following way/user/hdfs/testdata/1/test1/user/hdfs/testdata/2/test2/user/hdfs/testdata/3/test3/user/hdfs/testdata/4/test4RESOLUTIONTo make the subdirectories accessible set the following two properties before executing the create table statementset mapred.input.dir.recursive=true;set hive.mapred.supports.subdirectories=true;
PROBLEM: For an external hive table created based on hbase, if there are any missing mappings or any other issues (Syntactical), create table statement is executed successfully. You can see the table is created. However, while trying to insert data in that table, following error is seen: 08S01: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.tez.TezTask. Vertex failed, vertexName=Map 1, vertexId=vertex_1495472057323_3947_1_00, Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.MapObjectInspector at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:800) at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:838) at org.apache.hadoop.hive.ql.exec.SelectOpera
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.