Support Questions
Find answers, ask questions, and share your expertise

Metron REST Duplicate entry 'user' for key 'PRIMARY'

Metron REST Duplicate entry 'user' for key 'PRIMARY'

Contributor

Hi,

I followed in the instruction to create Metron Cluster and metronrest table from https://cwiki.apache.org/confluence/display/METRON/Metron+0.4.1+with+HDP+2.5+bare-metal+install+on+C...

However, every time I restart Metron REST I have to delete all entries from metronrest database table before restarting. Otherwise I'll keep getting the exception below. Does anyone has this issue or know of a permanent fix?

Thank you!

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'user' for key 'PRIMARY'at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:423)at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)at com.mysql.jdbc.Util.getInstance(Util.java:386)at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2820)at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2159)at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2462)at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2379)at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2363)at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:877)at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:870)at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)... 59 more
2 REPLIES 2

Re: Metron REST Duplicate entry 'user' for key 'PRIMARY'

Super Collaborator

Hello @Arian Trayen, can you try the steps from the Hortonworks documentation for setting up the Metron REST DB ?

https://docs.hortonworks.com/HDPDocuments/HCP1/HCP-1.3.0/bk_installation/content/installing_rest_app...

I have seen that these work fine for me without issues.

Re: Metron REST Duplicate entry 'user' for key 'PRIMARY'

Contributor

@asubramanian

Hi, I've followed the instruction. However, I'm not quite clear on the step after you install mysql-connector, then what you do with it or how to get to the next step to do the "flush privileges" because that command should be ran in mysql, but we exit mysql in the previous step. Another point is that mysql connector is installed during metron setup on all nodes.

Anyway, I followed all instruction except added a step to connect to mysql again to run the "flush privileges". After metron-rest started up successfully, I restarted it and ran into the same issue.

thank you for your help.